Skip to content

feat(events)!: cull stale annotated LLM histories#398

Merged
rapids-bot[bot] merged 1 commit into
NVIDIA:mainfrom
willkill07:feat/relay-445-limit-llm-event-context
Jul 11, 2026
Merged

feat(events)!: cull stale annotated LLM histories#398
rapids-bot[bot] merged 1 commit into
NVIDIA:mainfrom
willkill07:feat/relay-445-limit-llm-event-context

Conversation

@willkill07

@willkill07 willkill07 commented Jul 9, 2026

Copy link
Copy Markdown
Member

Overview

Warning

BREAKING CHANGE (Behavioral): LLM start request event inputs and annotations can omit earlier turns after the owning agent's freshness has been consumed. The request used for provider execution remains unchanged.

Implement RELAY-445 with per-agent freshness. A new agent session, and the first LLM start after compaction, retains the complete sanitized request history. Later starts cull the annotation and codec-backed event input to the current user turn.

  • I confirm this contribution is my own work, or I have the right to submit it under this project's license.
  • I searched existing issues and open pull requests, and this does not duplicate existing work.

Details

  • Track freshness for the implicit root and nested agent scopes independently, and remove explicit-agent state when its scope closes. Non-agent scopes inherit their nearest agent's freshness instead of creating a separate budget.
  • Atomically consume freshness at LLM start. Concurrent starts need not have a stable emission order, but exactly one consumes a fresh state.
  • Mark the owning agent fresh on canonical compaction events. Repeated marks are idempotent, and both PreCompact and PostCompact normalize to the shared canonical event name.
  • For stale agents, retain system instructions, the latest user message, and every following assistant or tool message. Handle empty, instruction-only, and no-user histories without cloning an annotation when projection is a no-op.
  • When a request codec is active, encode the projected annotation into the event-only LlmRequest so event.input and category_profile.annotated_request contain the same bounded history. If that event-only encode fails, emit a diagnostic, preserve the complete event input and annotation, and continue the provider call.
  • Leave response payloads, middleware/provider requests, caller-visible values, and existing public API signatures unchanged. This implementation has no history baselines, ordering queues, or response projection.
  • Keep ordinary mark events on the scope-stack read-lock path; acquire the write lock only for canonical compaction marks.
  • Add real-codec coverage for managed and streaming calls, including fail-open encode errors; projection edge cases and no-op allocation behavior; implicit-root and nested-agent inheritance; concurrent starts; and repeated compaction marks.
  • Move documentation and consumer-skill updates to the documentation-only follow-up PR docs: document LLM event freshness behavior #406.

Validation:

  • cargo fmt --all
  • just test-rust — 833 core unit tests plus integration tests passed
  • cargo clippy --workspace --all-targets -- -D warnings
  • just test-python — 511 passed
  • just test-node — 254 passed
  • just test-go
  • uv run pre-commit run --all-files

Where should the reviewer start?

Start with crates/core/src/api/runtime/scope_stack.rs for the root/nested-agent freshness ownership, crates/core/src/api/llm.rs for fail-open event-only request projection, and crates/core/tests/unit/llm_api_tests.rs for the behavioral contract.

Related Issues: (use one of the action keywords Closes / Fixes / Resolves / Relates to)

  • Fixes: RELAY-445

@willkill07 willkill07 requested review from a team and lvojtku as code owners July 9, 2026 13:43
@coderabbitai

coderabbitai Bot commented Jul 9, 2026

Copy link
Copy Markdown

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

Walkthrough

LLM start events now project annotated request history for non-fresh agents, while codec-backed execution preserves provider input and restores annotations if re-encoding fails. Scope freshness is tracked per owning agent, compaction events re-arm freshness, and CLI normalization recognizes PostCompact events.

Changes

LLM annotation history and compaction

Layer / File(s) Summary
Scope freshness and compaction signaling
crates/core/src/api/runtime/scope_stack.rs, crates/core/src/api/scope.rs, crates/cli/src/adapters/mod.rs, crates/cli/tests/coverage/adapters_tests.rs, crates/core/tests/unit/context_tests.rs
Tracks freshness per owning agent, re-arms it for canonical compaction events, and normalizes PreCompact/PostCompact events.
Emitted annotation projection
crates/core/src/api/llm.rs
Projects stale annotations to the current user turn, optionally re-encodes codec-backed requests, and restores the original annotation after encoding failure.
Lifecycle and concurrency validation
crates/core/tests/unit/llm_api_tests.rs
Tests history projection, managed and streaming calls, codec failures, nested agents, non-agent scopes, repeated compaction, and concurrent freshness consumption.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant LlmCall
  participant ScopeStack
  participant RequestCodec
  participant StartSubscriber
  LlmCall->>ScopeStack: consume agent freshness
  ScopeStack-->>LlmCall: fresh or stale state
  LlmCall->>RequestCodec: re-encode projected annotation when stale
  LlmCall->>StartSubscriber: emit sanitized LLM Start event
Loading
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title follows Conventional Commits and clearly matches the PR's stale LLM history culling change.
Description check ✅ Passed The description includes all required sections and provides detailed implementation, review guidance, and issue linkage.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added size:M PR is medium Feature a new feature breaking PR introduces a breaking change lang:rust PR changes/introduces Rust code labels Jul 9, 2026
@github-actions

github-actions Bot commented Jul 9, 2026

Copy link
Copy Markdown

@willkill07 willkill07 added this to the 0.6 milestone Jul 9, 2026
@willkill07 willkill07 self-assigned this Jul 9, 2026
@willkill07 willkill07 changed the title feat!: limit emitted LLM events to current user turn feat(events)!: limit emitted LLM events to current user turn Jul 9, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@crates/core/src/api/llm.rs`:
- Around line 282-290: The history filter in
limit_json_history_to_current_user_turn is dropping OpenAI Responses instruction
items with role developer by only retaining system markers. Update the retention
predicate passed to retain_current_user_turn so it preserves both system and
developer roles alongside the current user turn, using the existing Json role
checks in this function.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Enterprise

Run ID: 0025c458-0ef6-4506-8991-15d40437f679

📥 Commits

Reviewing files that changed from the base of the PR and between c83c8f2 and eb244e2.

📒 Files selected for processing (9)
  • crates/core/src/api/llm.rs
  • crates/core/tests/unit/llm_api_tests.rs
  • crates/core/tests/unit/observability/atof_tests.rs
  • docs/about-nemo-relay/concepts/events.mdx
  • docs/configure-plugins/observability/atof.mdx
  • docs/instrument-applications/instrument-llm-call.mdx
  • skills/nemo-relay-export-atif-trajectories/SKILL.md
  • skills/nemo-relay-export-openinference/SKILL.md
  • skills/nemo-relay-setup-observability/SKILL.md
📜 Review details
🧰 Additional context used
📓 Path-based instructions (28)
**/*.{md,rst,html,txt}

📄 CodeRabbit inference engine (.agents/skills/review-doc-style/assets/nvidia-style-brand-terminology.md)

**/*.{md,rst,html,txt}: Always spell NVIDIA in all caps. Do not use Nvidia, nvidia, nVidia, nVIDIA, or NV.
Use an NVIDIA before a noun because the name starts with an 'en' sound.
Do not add a registered trademark symbol after NVIDIA when referring to the company.
Use trademark symbols with product names only when the document type or legal guidance requires them.
Verify official capitalization, spacing, and hyphenation for product names.
Precede NVIDIA product names with NVIDIA on first mention when it is natural and accurate.
Do not rewrite product names for grammar or title-case rules.
Preserve third-party product names according to the owner's spelling.
Include the company name and full model qualifier on first use when it helps identify the model.
Preserve the official capitalization and punctuation of model names.
Use shorter family names only after the full name is established.
Spell out a term on first use and put the acronym in parentheses unless the acronym is widely understood by the intended audience.
Use the acronym on later mentions after it has been defined.
For long documents, reintroduce the full term if readers might lose context.
Form plurals of acronyms with s, not an apostrophe, such as GPUs.
In headings, common acronyms can remain abbreviated. Spell out the term in the first or second sentence of the body.
Common terms such as CPU, GPU, PC, API, and UI usually do not need to be spelled out for developer audiences.

Files:

  • skills/nemo-relay-export-openinference/SKILL.md
  • skills/nemo-relay-setup-observability/SKILL.md
  • skills/nemo-relay-export-atif-trajectories/SKILL.md
**/*.{md,rst,html}

📄 CodeRabbit inference engine (.agents/skills/review-doc-style/assets/nvidia-style-brand-terminology.md)

Link the first mention of a product name when the destination helps the reader.

Files:

  • skills/nemo-relay-export-openinference/SKILL.md
  • skills/nemo-relay-setup-observability/SKILL.md
  • skills/nemo-relay-export-atif-trajectories/SKILL.md
**/*.{md,rst,txt}

📄 CodeRabbit inference engine (.agents/skills/review-doc-style/assets/nvidia-style-guide.md)

Spell NVIDIA in all caps. Do not use Nvidia, nvidia, or NV.

Files:

  • skills/nemo-relay-export-openinference/SKILL.md
  • skills/nemo-relay-setup-observability/SKILL.md
  • skills/nemo-relay-export-atif-trajectories/SKILL.md
**/*.{md,rst}

📄 CodeRabbit inference engine (.agents/skills/review-doc-style/assets/nvidia-style-guide.md)

**/*.{md,rst}: Format commands, code elements, expressions, package names, file names, and paths as inline code.
Use descriptive link text. Avoid raw URLs and weak anchors such as "here" or "read more."
Use title case consistently for technical documentation headings.
Introduce code blocks, lists, tables, and images with complete sentences.
Write procedures as imperative steps. Keep steps parallel and split long procedures into smaller tasks.
Prefer active voice, present tense, short sentences, contractions, and plain English.
Use can for possibility and reserve may for permission.
Use after for temporal relationships instead of once.
Prefer refer to over see when the wording points readers to another resource.
Avoid culture-specific idioms, unnecessary Latinisms, jokes, and marketing exaggeration in technical docs.
Spell out months in body text, avoid ordinal dates, and use clear time zones.
Spell out whole numbers from zero through nine unless they are technical values, parameters, versions, or UI values.
Use numerals for 10 or greater and include commas in thousands.
Do not add trademark symbols to learning-oriented docs unless the source, platform, or legal guidance explicitly requires them.

Files:

  • skills/nemo-relay-export-openinference/SKILL.md
  • skills/nemo-relay-setup-observability/SKILL.md
  • skills/nemo-relay-export-atif-trajectories/SKILL.md
**/*.md

📄 CodeRabbit inference engine (.agents/skills/review-doc-style/assets/nvidia-style-technical-docs.md)

**/*.md: Use title case consistently in technical documentation headings
Avoid quotation marks, ampersands, and exclamation marks in headings
Keep product, event, research, and whitepaper names in their official title case
Use title case for table headers
Do not force social-media sentence case into technical docs
Format code elements, commands, parameters, package names, and expressions in monospace
Format directories, file names, and paths in monospace using backticks
Use angle brackets inside monospace for variables inside paths, such as /home/<username>/.login
Format error messages and strings in quotation marks, keeping literal code strings in code formatting when clearer
Format UI buttons, menus, fields, and labels in bold
Use angle brackets between UI labels for menu paths, such as File > Save As
Use italics for new terms on first use, sparingly and only when introducing the term
Use italics for publication titles
Format keyboard shortcuts in plain text, such as Press Ctrl+Alt+Delete
Use owner/repo link text for GitHub repositories, preferring [NVIDIA/NeMo](link) over prose references like 'the GitHub repo'
Introduce every code block with a complete sentence
Do not make a code block complete the grammar of the previous sentence
Do not continue a sentence after a code block
Use syntax highlighting when the format supports it for code blocks
Avoid the word 'snippet' unless the surrounding docs already use it as a term of art
Keep inline method, function, and class references consistent with nearby docs, omitting empty parentheses for prose readability when no call is shown
Use descriptive anchor text that matches the destination title when possible for links
Avoid raw URLs in running text
Avoid generic anchor text such as 'here,' 'this page,' and 'read more'
Include acronyms in link text when a linked term includes an acronym
Do not link long sentences or multiple sentences
Avoid links that pull readers away from a procedure unless the link is a p...

Files:

  • skills/nemo-relay-export-openinference/SKILL.md
  • skills/nemo-relay-setup-observability/SKILL.md
  • skills/nemo-relay-export-atif-trajectories/SKILL.md
**/SKILL.md

📄 CodeRabbit inference engine (AGENTS.md)

SKILL.md files are skill entrypoints and must start with YAML frontmatter containing at least name and description.

Files:

  • skills/nemo-relay-export-openinference/SKILL.md
  • skills/nemo-relay-setup-observability/SKILL.md
  • skills/nemo-relay-export-atif-trajectories/SKILL.md

⚙️ CodeRabbit configuration file

**/SKILL.md: Do not flag SKILL.md files for missing SPDX headers. Skill entrypoints intentionally start with YAML frontmatter instead.
Verify that every SKILL.md keeps valid YAML frontmatter with at least name and description fields before the Markdown body.

Files:

  • skills/nemo-relay-export-openinference/SKILL.md
  • skills/nemo-relay-setup-observability/SKILL.md
  • skills/nemo-relay-export-atif-trajectories/SKILL.md
**/*.{md,mdx}

📄 CodeRabbit inference engine (AGENTS.md)

Update README.md, fern/, package READMEs, and binding-support notes when public behavior, package names, examples, or supported bindings change.

**/*.{md,mdx}: Prefer the documented public API, not internal shortcuts
Keep package names, repo references, and build commands current
Keep release-process and release-notes guidance in repo-maintainer docs such as RELEASING.md, not as user-facing docs pages or CHANGELOG.md
Keep stable user-facing wrappers at scripts/ root in docs and examples; only point at namespaced helper paths when documenting internal maintenance work
When detailed dynamic plugin guides exist, keep Rust native plugin examples, Python worker plugin examples, and grpc-v1 protocol details on separate pages

If links in documentation change, run just docs-linkcheck.

Files:

  • skills/nemo-relay-export-openinference/SKILL.md
  • skills/nemo-relay-setup-observability/SKILL.md
  • docs/instrument-applications/instrument-llm-call.mdx
  • docs/about-nemo-relay/concepts/events.mdx
  • docs/configure-plugins/observability/atof.mdx
  • skills/nemo-relay-export-atif-trajectories/SKILL.md
**/*.{md,markdown,mdx}

📄 CodeRabbit inference engine (CONTRIBUTING.md)

Add the SPDX license header to all Markdown/MDX documentation files using the HTML comment block form.

Files:

  • skills/nemo-relay-export-openinference/SKILL.md
  • skills/nemo-relay-setup-observability/SKILL.md
  • docs/instrument-applications/instrument-llm-call.mdx
  • docs/about-nemo-relay/concepts/events.mdx
  • docs/configure-plugins/observability/atof.mdx
  • skills/nemo-relay-export-atif-trajectories/SKILL.md
**/*

📄 CodeRabbit inference engine (.agents/skills/validate-change/SKILL.md)

**/*: Format changed files with the language-native formatter before the final lint/test pass.
If dynamic plugin behavior changed, use maintain-dynamic-plugins and include the native SDK, worker protocol, Python SDK, docs, packaging, and Codecov surfaces in the validation plan.
If code changes alter APIs, bindings, commands, paths, packaging behavior, observability/adaptive semantics, or documented best practices, update any dependent maintainer or consumer skills in the same branch.
During iteration, prefer uv run pre-commit run --files <changed files...>.
Before review or handoff, run uv run pre-commit run --all-files.

Files:

  • skills/nemo-relay-export-openinference/SKILL.md
  • skills/nemo-relay-setup-observability/SKILL.md
  • docs/instrument-applications/instrument-llm-call.mdx
  • docs/about-nemo-relay/concepts/events.mdx
  • docs/configure-plugins/observability/atof.mdx
  • skills/nemo-relay-export-atif-trajectories/SKILL.md
  • crates/core/tests/unit/observability/atof_tests.rs
  • crates/core/tests/unit/llm_api_tests.rs
  • crates/core/src/api/llm.rs
**

⚙️ CodeRabbit configuration file

**:

AGENTS.md

This file provides guidance to agents, including Claude Code and OpenAI Codex, when working in this repository.

Project Overview

NeMo Relay is a multi-language agent runtime framework for execution scopes, lifecycle events, middleware, plugins, and observability around tool and LLM calls. The core runtime is Rust. Primary supported bindings are Rust, Python, and Node.js. Go and the raw C FFI are experimental and source-first.

The shared runtime model is:

  1. Scope stacks decide where work belongs and which scope-local behavior is visible.
  2. Middleware registries decide what guardrails and intercepts run around managed calls.
  3. Plugins install reusable runtime behavior from configuration.
  4. Events record runtime behavior in ATOF form.
  5. Subscribers and exporters consume events in-process or export them to ATIF, OpenTelemetry, OpenInference, or other backends.

Repository Structure

The repository layout separates the Rust runtime, language bindings,
documentation, integrations, and agent-facing skills.

crates/
  core/       # Rust core runtime crate, published as nemo-relay
  adaptive/   # Adaptive runtime primitives and plugin components
  python/     # PyO3 native extension for the Python package
  ffi/        # Raw C ABI layer used by downstream bindings such as Go
  node/       # NAPI Node.js binding and JavaScript/TypeScript entry points
python/
  nemo_relay/  # Python wrapper package: scopes, tools, LLM, middleware, typed helpers, plugins, adaptive helpers
  tests/      # Python tests
go/
  nemo_relay/  # Experimental Go CGo binding and tests
fern/         # Fern documentation site
scripts/      # Stable wrappers and helper scripts; build/test/docs entry points live in justfile
skills/       # Published Codex/agent skills for NeMo Relay usage patterns

Prerequisites

Insta...

Files:

  • skills/nemo-relay-export-openinference/SKILL.md
  • skills/nemo-relay-setup-observability/SKILL.md
  • docs/instrument-applications/instrument-llm-call.mdx
  • docs/about-nemo-relay/concepts/events.mdx
  • docs/configure-plugins/observability/atof.mdx
  • skills/nemo-relay-export-atif-trajectories/SKILL.md
  • crates/core/tests/unit/observability/atof_tests.rs
  • crates/core/tests/unit/llm_api_tests.rs
  • crates/core/src/api/llm.rs
**/*.mdx

📄 CodeRabbit inference engine (.agents/skills/review-doc-style/SKILL.md)

MDX top-of-file SPDX comments must use {/* ... */} delimiters instead of HTML comment delimiters (Must-Fix)

In MDX files, top-of-file comments must use JSX comment delimiters ({/* to open and */} to close); do not use HTML comments for MDX SPDX headers

Files:

  • docs/instrument-applications/instrument-llm-call.mdx
  • docs/about-nemo-relay/concepts/events.mdx
  • docs/configure-plugins/observability/atof.mdx
{docs,examples}/**/*

📄 CodeRabbit inference engine (.agents/skills/rename-surfaces/SKILL.md)

Update docs and examples.

Files:

  • docs/instrument-applications/instrument-llm-call.mdx
  • docs/about-nemo-relay/concepts/events.mdx
  • docs/configure-plugins/observability/atof.mdx
docs/**/*

📄 CodeRabbit inference engine (.agents/skills/validate-change/SKILL.md)

If documentation examples or commands under docs/ change, run the targeted docs checks appropriate to the change.

Files:

  • docs/instrument-applications/instrument-llm-call.mdx
  • docs/about-nemo-relay/concepts/events.mdx
  • docs/configure-plugins/observability/atof.mdx
{docs/**,README.md,CONTRIBUTING.md,RELEASING.md,SECURITY.md}

⚙️ CodeRabbit configuration file

{docs/**,README.md,CONTRIBUTING.md,RELEASING.md,SECURITY.md}: Review documentation for technical accuracy against the current API, command correctness, and consistency across language bindings.
Flag stale examples, missing SPDX headers where required, and instructions that no longer match CI or pre-commit behavior.

Files:

  • docs/instrument-applications/instrument-llm-call.mdx
  • docs/about-nemo-relay/concepts/events.mdx
  • docs/configure-plugins/observability/atof.mdx
**/*.rs

📄 CodeRabbit inference engine (.agents/skills/prepare-pr/SKILL.md)

**/*.rs: Any Rust change must run just test-rust
Any Rust change must run cargo fmt --all
Any Rust change must run cargo clippy --workspace --all-targets -- -D warnings

**/*.rs: Run cargo fmt --all for all FFI work since it is Rust work
Run just test-rust to validate FFI changes
Run cargo clippy --workspace --all-targets -- -D warnings to enforce strict linting on FFI work

When Rust files changed as part of Go work, also run cargo fmt --all, just test-rust, and cargo clippy --workspace --all-targets -- -D warnings

**/*.rs: Run cargo fmt --all when Rust files are changed as part of Node work
Run cargo clippy --workspace --all-targets -- -D warnings when Rust files are changed as part of Node work
Run just test-rust when Rust files are changed as part of Node work

When changing the core Rust runtime or Rust-facing API surface, format Rust code with cargo fmt (rustfmt defaults), keep cargo clippy -- -D warnings clean, and satisfy cargo deny check per deny.toml.

**/*.rs: If any Rust code changed, always run just test-rust.
If any Rust code changed, also run cargo fmt --all.
If any Rust code changed, also run cargo clippy --workspace --all-targets -- -D warnings.
For Rust changes headed for review, run cargo fmt --all and cargo clippy --workspace --all-targets -- -D warnings even if relying on pre-commit.

Files:

  • crates/core/tests/unit/observability/atof_tests.rs
  • crates/core/tests/unit/llm_api_tests.rs
  • crates/core/src/api/llm.rs
{crates/core,crates/adaptive}/**/*

📄 CodeRabbit inference engine (.agents/skills/prepare-pr/SKILL.md)

Changes to crates/core or crates/adaptive must run the full language matrix

Files:

  • crates/core/tests/unit/observability/atof_tests.rs
  • crates/core/tests/unit/llm_api_tests.rs
  • crates/core/src/api/llm.rs
crates/core/**/*.rs

📄 CodeRabbit inference engine (.agents/skills/test-go-binding/SKILL.md)

If the change touched crates/core or shared runtime semantics, also use validate-change for broader validation

Files:

  • crates/core/tests/unit/observability/atof_tests.rs
  • crates/core/tests/unit/llm_api_tests.rs
  • crates/core/src/api/llm.rs
**/*.{rs,py}

📄 CodeRabbit inference engine (AGENTS.md)

Follow binding naming conventions in Rust and Python: use snake_case.

Files:

  • crates/core/tests/unit/observability/atof_tests.rs
  • crates/core/tests/unit/llm_api_tests.rs
  • crates/core/src/api/llm.rs
**/*.{rs,py,js,mjs,cjs,ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

**/*.{rs,py,js,mjs,cjs,ts,tsx}: Use Json = serde_json::Value in Rust-facing runtime APIs where the existing code expects JSON payloads.
Use Result<T> with FlowError in core runtime paths, and keep errors explicit and binding-appropriate at the wrapper layer.
Keep async behavior on the existing tokio-based model; bindings should preserve callback and future lifetimes rather than blocking or hiding async work unexpectedly.

Files:

  • crates/core/tests/unit/observability/atof_tests.rs
  • crates/core/tests/unit/llm_api_tests.rs
  • crates/core/src/api/llm.rs
**/*.{rs,py,go,js,ts,c,h}

📄 CodeRabbit inference engine (CONTRIBUTING.md)

Use language-appropriate naming conventions: Rust snake_case, C FFI exports prefixed nemo_relay_, Go PascalCase, Node.js camelCase, and Python snake_case.

Files:

  • crates/core/tests/unit/observability/atof_tests.rs
  • crates/core/tests/unit/llm_api_tests.rs
  • crates/core/src/api/llm.rs
**/*.{rs,go,js,ts}

📄 CodeRabbit inference engine (CONTRIBUTING.md)

Add the SPDX license header to all Rust, Go, JavaScript, and TypeScript source files using the corresponding // comment form.

Files:

  • crates/core/tests/unit/observability/atof_tests.rs
  • crates/core/tests/unit/llm_api_tests.rs
  • crates/core/src/api/llm.rs
crates/{core,adaptive}/**/*

📄 CodeRabbit inference engine (.agents/skills/validate-change/SKILL.md)

If crates/core or crates/adaptive changed, run the full validation matrix across Rust, Python, Go, and Node.js.

Files:

  • crates/core/tests/unit/observability/atof_tests.rs
  • crates/core/tests/unit/llm_api_tests.rs
  • crates/core/src/api/llm.rs
**/*.{rs,py,go,js,ts}

📄 CodeRabbit inference engine (.agents/skills/validate-change/SKILL.md)

If a language surface changed, always run that language's test target even when Rust core did not change.

Files:

  • crates/core/tests/unit/observability/atof_tests.rs
  • crates/core/tests/unit/llm_api_tests.rs
  • crates/core/src/api/llm.rs
crates/{core,adaptive}/**/*.rs

⚙️ CodeRabbit configuration file

crates/{core,adaptive}/**/*.rs: Review the Rust runtime for async correctness, scope isolation, middleware ordering, and event lifecycle regressions.
Pay close attention to task-local/thread-local scope propagation, callback lifetimes, stream finalization, and root_uuid isolation.
Public API changes should preserve existing behavior unless tests and docs show the intended migration path.

Files:

  • crates/core/tests/unit/observability/atof_tests.rs
  • crates/core/tests/unit/llm_api_tests.rs
  • crates/core/src/api/llm.rs
{crates/**/tests/**,python/tests/**,go/nemo_relay/**/*_test.go}

⚙️ CodeRabbit configuration file

{crates/**/tests/**,python/tests/**,go/nemo_relay/**/*_test.go}: Tests should cover the behavior promised by the changed API surface, including error paths and cross-request isolation where relevant.
Prefer assertions on lifecycle events, scope stacks, middleware ordering, and binding parity over shallow smoke tests.

Files:

  • crates/core/tests/unit/observability/atof_tests.rs
  • crates/core/tests/unit/llm_api_tests.rs
crates/core/src/api/{tool,llm}.rs

📄 CodeRabbit inference engine (.agents/skills/add-middleware/SKILL.md)

Wire the new middleware chain into the execute path in crates/core/src/api/tool.rs or crates/core/src/api/llm.rs at the appropriate pipeline stage

Files:

  • crates/core/src/api/llm.rs
crates/core/src/{api/**/*.rs,api/runtime/**/*.rs,codec/**/*.rs,json.rs}

📄 CodeRabbit inference engine (.agents/skills/add-binding-feature/SKILL.md)

Implement the new or changed public runtime behavior first in the Rust core, especially under crates/core/src/api/ and related core modules such as crates/core/src/api/runtime/, crates/core/src/codec/, and crates/core/src/json.rs.

Files:

  • crates/core/src/api/llm.rs
{crates/**/src/**/*.rs,python/**/*.py}

📄 CodeRabbit inference engine (.agents/skills/maintain-dynamic-plugins/SKILL.md)

Do not add tests under src; Rust tests belong in crate tests/ trees, and Python SDK tests belong under python/tests.

Files:

  • crates/core/src/api/llm.rs
🔇 Additional comments (9)
crates/core/tests/unit/llm_api_tests.rs (1)

14-25: LGTM!

Also applies to: 48-208, 210-257

crates/core/tests/unit/observability/atof_tests.rs (1)

11-11: LGTM!

Also applies to: 1257-1326

docs/about-nemo-relay/concepts/events.mdx (1)

83-91: LGTM!

Also applies to: 106-107

docs/configure-plugins/observability/atof.mdx (1)

104-105: LGTM!

docs/instrument-applications/instrument-llm-call.mdx (1)

241-245: LGTM!

skills/nemo-relay-export-atif-trajectories/SKILL.md (1)

26-28: LGTM!

skills/nemo-relay-export-openinference/SKILL.md (1)

32-33: LGTM!

skills/nemo-relay-setup-observability/SKILL.md (1)

41-43: LGTM!

crates/core/src/api/llm.rs (1)

293-345: 📐 Maintainability & Code Quality

Verify the required Rust and core-runtime validation pass.

This touches crates/core, so please confirm cargo fmt --all, cargo clippy --workspace --all-targets -- -D warnings, just test-rust, and the full binding validation matrix required for core changes were run. As per coding guidelines, “Any Rust change must run just test-rust,” “Any Rust change must run cargo fmt --all,” and “Any Rust change must run cargo clippy --workspace --all-targets -- -D warnings.” As per path instructions, “Changes to crates/core or crates/adaptive must run the full language matrix.”

Also applies to: 388-400, 473-475, 527-529, 574-603

Sources: Coding guidelines, Path instructions

Comment thread crates/core/src/api/llm.rs Outdated
@github-actions github-actions Bot added size:L PR is large and removed size:M PR is medium labels Jul 9, 2026
@willkill07 willkill07 changed the title feat(events)!: limit emitted LLM events to current user turn feat(events)!: bound LLM history with context baselines Jul 9, 2026
@willkill07 willkill07 force-pushed the feat/relay-445-limit-llm-event-context branch from 815bc5e to a36fd97 Compare July 9, 2026 15:02

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
crates/core/tests/unit/llm_api_tests.rs (1)

131-170: 🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick win

Snapshot the codec annotations too.

The current assertions only prove the raw request and response JSON stay untouched. They do not catch an in-place mutation of annotated_request or annotated_response, which is the boundary this test is meant to protect.

🧪 Suggested check
+    let original_annotated_request = annotated_request.as_ref().clone();

Repeat the same snapshot for the response annotation before wrapping it in Arc.

Also applies to: 284-285

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@crates/core/tests/unit/llm_api_tests.rs` around lines 131 - 170, The test
only snapshots the raw request/response and still misses in-place mutation of
the codec annotations. In llm_api_tests around the llm_call / llm_call_end flow,
add a snapshot for the response annotation before wrapping it in Arc, similar to
original_request and original_response. Use the existing annotated_request and
annotated_response symbols to verify both annotations remain unchanged across
the call boundary.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In `@crates/core/tests/unit/llm_api_tests.rs`:
- Around line 131-170: The test only snapshots the raw request/response and
still misses in-place mutation of the codec annotations. In llm_api_tests around
the llm_call / llm_call_end flow, add a snapshot for the response annotation
before wrapping it in Arc, similar to original_request and original_response.
Use the existing annotated_request and annotated_response symbols to verify both
annotations remain unchanged across the call boundary.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Enterprise

Run ID: 410d12ed-2321-47b5-854a-952f26aed438

📥 Commits

Reviewing files that changed from the base of the PR and between 0f2a72c and a36fd97.

📒 Files selected for processing (17)
  • crates/cli/src/adapters/mod.rs
  • crates/cli/tests/coverage/adapters_tests.rs
  • crates/core/src/api/llm.rs
  • crates/core/src/api/runtime/scope_stack.rs
  • crates/core/src/api/runtime/state.rs
  • crates/core/tests/unit/context_tests.rs
  • crates/core/tests/unit/llm_api_tests.rs
  • crates/core/tests/unit/observability/atof_tests.rs
  • docs/about-nemo-relay/concepts/events.mdx
  • docs/configure-plugins/observability/atof.mdx
  • docs/instrument-applications/instrument-llm-call.mdx
  • docs/nemo-relay-cli/basic-usage.mdx
  • docs/nemo-relay-cli/claude-code.mdx
  • docs/nemo-relay-cli/codex.mdx
  • skills/nemo-relay-export-atif-trajectories/SKILL.md
  • skills/nemo-relay-export-openinference/SKILL.md
  • skills/nemo-relay-setup-observability/SKILL.md
📜 Review details
⏰ Context from checks skipped due to timeout. (20)
  • GitHub Check: Node.js / Test (windows-amd64)
  • GitHub Check: Node.js / Test (macos-arm64)
  • GitHub Check: Node.js / Test (windows-arm64)
  • GitHub Check: Python / Test (linux-arm64)
  • GitHub Check: Node.js / Test (linux-arm64)
  • GitHub Check: Go / Test (macos-arm64)
  • GitHub Check: Python / Test (macos-arm64)
  • GitHub Check: Node.js / Test (linux-amd64)
  • GitHub Check: Python / Test (windows-arm64)
  • GitHub Check: Go / Test (windows-arm64)
  • GitHub Check: Python / Test (linux-amd64)
  • GitHub Check: Go / Test (windows-amd64)
  • GitHub Check: Rust / Test (linux-amd64)
  • GitHub Check: Python / Test (windows-amd64)
  • GitHub Check: Rust / Test (macos-arm64)
  • GitHub Check: Rust / Test (linux-arm64)
  • GitHub Check: Rust / Test (windows-arm64)
  • GitHub Check: Go / Test (linux-amd64)
  • GitHub Check: Go / Test (linux-arm64)
  • GitHub Check: Rust / Test (windows-amd64)
🧰 Additional context used
📓 Path-based instructions (29)
**/*.{md,rst,html,txt}

📄 CodeRabbit inference engine (.agents/skills/review-doc-style/assets/nvidia-style-brand-terminology.md)

**/*.{md,rst,html,txt}: Always spell NVIDIA in all caps. Do not use Nvidia, nvidia, nVidia, nVIDIA, or NV.
Use an NVIDIA before a noun because the name starts with an 'en' sound.
Do not add a registered trademark symbol after NVIDIA when referring to the company.
Use trademark symbols with product names only when the document type or legal guidance requires them.
Verify official capitalization, spacing, and hyphenation for product names.
Precede NVIDIA product names with NVIDIA on first mention when it is natural and accurate.
Do not rewrite product names for grammar or title-case rules.
Preserve third-party product names according to the owner's spelling.
Include the company name and full model qualifier on first use when it helps identify the model.
Preserve the official capitalization and punctuation of model names.
Use shorter family names only after the full name is established.
Spell out a term on first use and put the acronym in parentheses unless the acronym is widely understood by the intended audience.
Use the acronym on later mentions after it has been defined.
For long documents, reintroduce the full term if readers might lose context.
Form plurals of acronyms with s, not an apostrophe, such as GPUs.
In headings, common acronyms can remain abbreviated. Spell out the term in the first or second sentence of the body.
Common terms such as CPU, GPU, PC, API, and UI usually do not need to be spelled out for developer audiences.

Files:

  • skills/nemo-relay-setup-observability/SKILL.md
  • skills/nemo-relay-export-openinference/SKILL.md
  • skills/nemo-relay-export-atif-trajectories/SKILL.md
**/*.{md,rst,html}

📄 CodeRabbit inference engine (.agents/skills/review-doc-style/assets/nvidia-style-brand-terminology.md)

Link the first mention of a product name when the destination helps the reader.

Files:

  • skills/nemo-relay-setup-observability/SKILL.md
  • skills/nemo-relay-export-openinference/SKILL.md
  • skills/nemo-relay-export-atif-trajectories/SKILL.md
**/*.{md,rst,txt}

📄 CodeRabbit inference engine (.agents/skills/review-doc-style/assets/nvidia-style-guide.md)

Spell NVIDIA in all caps. Do not use Nvidia, nvidia, or NV.

Files:

  • skills/nemo-relay-setup-observability/SKILL.md
  • skills/nemo-relay-export-openinference/SKILL.md
  • skills/nemo-relay-export-atif-trajectories/SKILL.md
**/*.{md,rst}

📄 CodeRabbit inference engine (.agents/skills/review-doc-style/assets/nvidia-style-guide.md)

**/*.{md,rst}: Format commands, code elements, expressions, package names, file names, and paths as inline code.
Use descriptive link text. Avoid raw URLs and weak anchors such as "here" or "read more."
Use title case consistently for technical documentation headings.
Introduce code blocks, lists, tables, and images with complete sentences.
Write procedures as imperative steps. Keep steps parallel and split long procedures into smaller tasks.
Prefer active voice, present tense, short sentences, contractions, and plain English.
Use can for possibility and reserve may for permission.
Use after for temporal relationships instead of once.
Prefer refer to over see when the wording points readers to another resource.
Avoid culture-specific idioms, unnecessary Latinisms, jokes, and marketing exaggeration in technical docs.
Spell out months in body text, avoid ordinal dates, and use clear time zones.
Spell out whole numbers from zero through nine unless they are technical values, parameters, versions, or UI values.
Use numerals for 10 or greater and include commas in thousands.
Do not add trademark symbols to learning-oriented docs unless the source, platform, or legal guidance explicitly requires them.

Files:

  • skills/nemo-relay-setup-observability/SKILL.md
  • skills/nemo-relay-export-openinference/SKILL.md
  • skills/nemo-relay-export-atif-trajectories/SKILL.md
**/*.md

📄 CodeRabbit inference engine (.agents/skills/review-doc-style/assets/nvidia-style-technical-docs.md)

**/*.md: Use title case consistently in technical documentation headings
Avoid quotation marks, ampersands, and exclamation marks in headings
Keep product, event, research, and whitepaper names in their official title case
Use title case for table headers
Do not force social-media sentence case into technical docs
Format code elements, commands, parameters, package names, and expressions in monospace
Format directories, file names, and paths in monospace using backticks
Use angle brackets inside monospace for variables inside paths, such as /home/<username>/.login
Format error messages and strings in quotation marks, keeping literal code strings in code formatting when clearer
Format UI buttons, menus, fields, and labels in bold
Use angle brackets between UI labels for menu paths, such as File > Save As
Use italics for new terms on first use, sparingly and only when introducing the term
Use italics for publication titles
Format keyboard shortcuts in plain text, such as Press Ctrl+Alt+Delete
Use owner/repo link text for GitHub repositories, preferring [NVIDIA/NeMo](link) over prose references like 'the GitHub repo'
Introduce every code block with a complete sentence
Do not make a code block complete the grammar of the previous sentence
Do not continue a sentence after a code block
Use syntax highlighting when the format supports it for code blocks
Avoid the word 'snippet' unless the surrounding docs already use it as a term of art
Keep inline method, function, and class references consistent with nearby docs, omitting empty parentheses for prose readability when no call is shown
Use descriptive anchor text that matches the destination title when possible for links
Avoid raw URLs in running text
Avoid generic anchor text such as 'here,' 'this page,' and 'read more'
Include acronyms in link text when a linked term includes an acronym
Do not link long sentences or multiple sentences
Avoid links that pull readers away from a procedure unless the link is a p...

Files:

  • skills/nemo-relay-setup-observability/SKILL.md
  • skills/nemo-relay-export-openinference/SKILL.md
  • skills/nemo-relay-export-atif-trajectories/SKILL.md
**/SKILL.md

📄 CodeRabbit inference engine (AGENTS.md)

SKILL.md files are skill entrypoints and must start with YAML frontmatter containing at least name and description.

Files:

  • skills/nemo-relay-setup-observability/SKILL.md
  • skills/nemo-relay-export-openinference/SKILL.md
  • skills/nemo-relay-export-atif-trajectories/SKILL.md

⚙️ CodeRabbit configuration file

**/SKILL.md: Do not flag SKILL.md files for missing SPDX headers. Skill entrypoints intentionally start with YAML frontmatter instead.
Verify that every SKILL.md keeps valid YAML frontmatter with at least name and description fields before the Markdown body.

Files:

  • skills/nemo-relay-setup-observability/SKILL.md
  • skills/nemo-relay-export-openinference/SKILL.md
  • skills/nemo-relay-export-atif-trajectories/SKILL.md
**/*.{md,mdx}

📄 CodeRabbit inference engine (AGENTS.md)

Update README.md, fern/, package READMEs, and binding-support notes when public behavior, package names, examples, or supported bindings change.

**/*.{md,mdx}: Prefer the documented public API, not internal shortcuts
Keep package names, repo references, and build commands current
Keep release-process and release-notes guidance in repo-maintainer docs such as RELEASING.md, not as user-facing docs pages or CHANGELOG.md
Keep stable user-facing wrappers at scripts/ root in docs and examples; only point at namespaced helper paths when documenting internal maintenance work
When detailed dynamic plugin guides exist, keep Rust native plugin examples, Python worker plugin examples, and grpc-v1 protocol details on separate pages

If links in documentation change, run just docs-linkcheck.

Files:

  • skills/nemo-relay-setup-observability/SKILL.md
  • skills/nemo-relay-export-openinference/SKILL.md
  • docs/nemo-relay-cli/codex.mdx
  • docs/instrument-applications/instrument-llm-call.mdx
  • docs/nemo-relay-cli/basic-usage.mdx
  • skills/nemo-relay-export-atif-trajectories/SKILL.md
  • docs/configure-plugins/observability/atof.mdx
  • docs/nemo-relay-cli/claude-code.mdx
  • docs/about-nemo-relay/concepts/events.mdx
**/*.{md,markdown,mdx}

📄 CodeRabbit inference engine (CONTRIBUTING.md)

Add the SPDX license header to all Markdown/MDX documentation files using the HTML comment block form.

Files:

  • skills/nemo-relay-setup-observability/SKILL.md
  • skills/nemo-relay-export-openinference/SKILL.md
  • docs/nemo-relay-cli/codex.mdx
  • docs/instrument-applications/instrument-llm-call.mdx
  • docs/nemo-relay-cli/basic-usage.mdx
  • skills/nemo-relay-export-atif-trajectories/SKILL.md
  • docs/configure-plugins/observability/atof.mdx
  • docs/nemo-relay-cli/claude-code.mdx
  • docs/about-nemo-relay/concepts/events.mdx
**/*

📄 CodeRabbit inference engine (.agents/skills/validate-change/SKILL.md)

**/*: Format changed files with the language-native formatter before the final lint/test pass.
If dynamic plugin behavior changed, use maintain-dynamic-plugins and include the native SDK, worker protocol, Python SDK, docs, packaging, and Codecov surfaces in the validation plan.
If code changes alter APIs, bindings, commands, paths, packaging behavior, observability/adaptive semantics, or documented best practices, update any dependent maintainer or consumer skills in the same branch.
During iteration, prefer uv run pre-commit run --files <changed files...>.
Before review or handoff, run uv run pre-commit run --all-files.

Files:

  • skills/nemo-relay-setup-observability/SKILL.md
  • skills/nemo-relay-export-openinference/SKILL.md
  • crates/core/tests/unit/context_tests.rs
  • docs/nemo-relay-cli/codex.mdx
  • docs/instrument-applications/instrument-llm-call.mdx
  • crates/cli/tests/coverage/adapters_tests.rs
  • docs/nemo-relay-cli/basic-usage.mdx
  • skills/nemo-relay-export-atif-trajectories/SKILL.md
  • docs/configure-plugins/observability/atof.mdx
  • crates/core/src/api/runtime/state.rs
  • docs/nemo-relay-cli/claude-code.mdx
  • crates/cli/src/adapters/mod.rs
  • docs/about-nemo-relay/concepts/events.mdx
  • crates/core/tests/unit/observability/atof_tests.rs
  • crates/core/src/api/llm.rs
  • crates/core/src/api/runtime/scope_stack.rs
  • crates/core/tests/unit/llm_api_tests.rs
**

⚙️ CodeRabbit configuration file

**:

AGENTS.md

This file provides guidance to agents, including Claude Code and OpenAI Codex, when working in this repository.

Project Overview

NeMo Relay is a multi-language agent runtime framework for execution scopes, lifecycle events, middleware, plugins, and observability around tool and LLM calls. The core runtime is Rust. Primary supported bindings are Rust, Python, and Node.js. Go and the raw C FFI are experimental and source-first.

The shared runtime model is:

  1. Scope stacks decide where work belongs and which scope-local behavior is visible.
  2. Middleware registries decide what guardrails and intercepts run around managed calls.
  3. Plugins install reusable runtime behavior from configuration.
  4. Events record runtime behavior in ATOF form.
  5. Subscribers and exporters consume events in-process or export them to ATIF, OpenTelemetry, OpenInference, or other backends.

Repository Structure

The repository layout separates the Rust runtime, language bindings,
documentation, integrations, and agent-facing skills.

crates/
  core/       # Rust core runtime crate, published as nemo-relay
  adaptive/   # Adaptive runtime primitives and plugin components
  python/     # PyO3 native extension for the Python package
  ffi/        # Raw C ABI layer used by downstream bindings such as Go
  node/       # NAPI Node.js binding and JavaScript/TypeScript entry points
python/
  nemo_relay/  # Python wrapper package: scopes, tools, LLM, middleware, typed helpers, plugins, adaptive helpers
  tests/      # Python tests
go/
  nemo_relay/  # Experimental Go CGo binding and tests
fern/         # Fern documentation site
scripts/      # Stable wrappers and helper scripts; build/test/docs entry points live in justfile
skills/       # Published Codex/agent skills for NeMo Relay usage patterns

Prerequisites

Insta...

Files:

  • skills/nemo-relay-setup-observability/SKILL.md
  • skills/nemo-relay-export-openinference/SKILL.md
  • crates/core/tests/unit/context_tests.rs
  • docs/nemo-relay-cli/codex.mdx
  • docs/instrument-applications/instrument-llm-call.mdx
  • crates/cli/tests/coverage/adapters_tests.rs
  • docs/nemo-relay-cli/basic-usage.mdx
  • skills/nemo-relay-export-atif-trajectories/SKILL.md
  • docs/configure-plugins/observability/atof.mdx
  • crates/core/src/api/runtime/state.rs
  • docs/nemo-relay-cli/claude-code.mdx
  • crates/cli/src/adapters/mod.rs
  • docs/about-nemo-relay/concepts/events.mdx
  • crates/core/tests/unit/observability/atof_tests.rs
  • crates/core/src/api/llm.rs
  • crates/core/src/api/runtime/scope_stack.rs
  • crates/core/tests/unit/llm_api_tests.rs
**/*.rs

📄 CodeRabbit inference engine (.agents/skills/prepare-pr/SKILL.md)

**/*.rs: Any Rust change must run just test-rust
Any Rust change must run cargo fmt --all
Any Rust change must run cargo clippy --workspace --all-targets -- -D warnings

**/*.rs: Run cargo fmt --all for all FFI work since it is Rust work
Run just test-rust to validate FFI changes
Run cargo clippy --workspace --all-targets -- -D warnings to enforce strict linting on FFI work

When Rust files changed as part of Go work, also run cargo fmt --all, just test-rust, and cargo clippy --workspace --all-targets -- -D warnings

**/*.rs: Run cargo fmt --all when Rust files are changed as part of Node work
Run cargo clippy --workspace --all-targets -- -D warnings when Rust files are changed as part of Node work
Run just test-rust when Rust files are changed as part of Node work

When changing the core Rust runtime or Rust-facing API surface, format Rust code with cargo fmt (rustfmt defaults), keep cargo clippy -- -D warnings clean, and satisfy cargo deny check per deny.toml.

**/*.rs: If any Rust code changed, always run just test-rust.
If any Rust code changed, also run cargo fmt --all.
If any Rust code changed, also run cargo clippy --workspace --all-targets -- -D warnings.
For Rust changes headed for review, run cargo fmt --all and cargo clippy --workspace --all-targets -- -D warnings even if relying on pre-commit.

Files:

  • crates/core/tests/unit/context_tests.rs
  • crates/cli/tests/coverage/adapters_tests.rs
  • crates/core/src/api/runtime/state.rs
  • crates/cli/src/adapters/mod.rs
  • crates/core/tests/unit/observability/atof_tests.rs
  • crates/core/src/api/llm.rs
  • crates/core/src/api/runtime/scope_stack.rs
  • crates/core/tests/unit/llm_api_tests.rs
{crates/core,crates/adaptive}/**/*

📄 CodeRabbit inference engine (.agents/skills/prepare-pr/SKILL.md)

Changes to crates/core or crates/adaptive must run the full language matrix

Files:

  • crates/core/tests/unit/context_tests.rs
  • crates/core/src/api/runtime/state.rs
  • crates/core/tests/unit/observability/atof_tests.rs
  • crates/core/src/api/llm.rs
  • crates/core/src/api/runtime/scope_stack.rs
  • crates/core/tests/unit/llm_api_tests.rs
crates/core/**/*.rs

📄 CodeRabbit inference engine (.agents/skills/test-go-binding/SKILL.md)

If the change touched crates/core or shared runtime semantics, also use validate-change for broader validation

Files:

  • crates/core/tests/unit/context_tests.rs
  • crates/core/src/api/runtime/state.rs
  • crates/core/tests/unit/observability/atof_tests.rs
  • crates/core/src/api/llm.rs
  • crates/core/src/api/runtime/scope_stack.rs
  • crates/core/tests/unit/llm_api_tests.rs
**/*.{rs,py}

📄 CodeRabbit inference engine (AGENTS.md)

Follow binding naming conventions in Rust and Python: use snake_case.

Files:

  • crates/core/tests/unit/context_tests.rs
  • crates/cli/tests/coverage/adapters_tests.rs
  • crates/core/src/api/runtime/state.rs
  • crates/cli/src/adapters/mod.rs
  • crates/core/tests/unit/observability/atof_tests.rs
  • crates/core/src/api/llm.rs
  • crates/core/src/api/runtime/scope_stack.rs
  • crates/core/tests/unit/llm_api_tests.rs
**/*.{rs,py,js,mjs,cjs,ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

**/*.{rs,py,js,mjs,cjs,ts,tsx}: Use Json = serde_json::Value in Rust-facing runtime APIs where the existing code expects JSON payloads.
Use Result<T> with FlowError in core runtime paths, and keep errors explicit and binding-appropriate at the wrapper layer.
Keep async behavior on the existing tokio-based model; bindings should preserve callback and future lifetimes rather than blocking or hiding async work unexpectedly.

Files:

  • crates/core/tests/unit/context_tests.rs
  • crates/cli/tests/coverage/adapters_tests.rs
  • crates/core/src/api/runtime/state.rs
  • crates/cli/src/adapters/mod.rs
  • crates/core/tests/unit/observability/atof_tests.rs
  • crates/core/src/api/llm.rs
  • crates/core/src/api/runtime/scope_stack.rs
  • crates/core/tests/unit/llm_api_tests.rs
**/*.{rs,py,go,js,ts,c,h}

📄 CodeRabbit inference engine (CONTRIBUTING.md)

Use language-appropriate naming conventions: Rust snake_case, C FFI exports prefixed nemo_relay_, Go PascalCase, Node.js camelCase, and Python snake_case.

Files:

  • crates/core/tests/unit/context_tests.rs
  • crates/cli/tests/coverage/adapters_tests.rs
  • crates/core/src/api/runtime/state.rs
  • crates/cli/src/adapters/mod.rs
  • crates/core/tests/unit/observability/atof_tests.rs
  • crates/core/src/api/llm.rs
  • crates/core/src/api/runtime/scope_stack.rs
  • crates/core/tests/unit/llm_api_tests.rs
**/*.{rs,go,js,ts}

📄 CodeRabbit inference engine (CONTRIBUTING.md)

Add the SPDX license header to all Rust, Go, JavaScript, and TypeScript source files using the corresponding // comment form.

Files:

  • crates/core/tests/unit/context_tests.rs
  • crates/cli/tests/coverage/adapters_tests.rs
  • crates/core/src/api/runtime/state.rs
  • crates/cli/src/adapters/mod.rs
  • crates/core/tests/unit/observability/atof_tests.rs
  • crates/core/src/api/llm.rs
  • crates/core/src/api/runtime/scope_stack.rs
  • crates/core/tests/unit/llm_api_tests.rs
crates/{core,adaptive}/**/*

📄 CodeRabbit inference engine (.agents/skills/validate-change/SKILL.md)

If crates/core or crates/adaptive changed, run the full validation matrix across Rust, Python, Go, and Node.js.

Files:

  • crates/core/tests/unit/context_tests.rs
  • crates/core/src/api/runtime/state.rs
  • crates/core/tests/unit/observability/atof_tests.rs
  • crates/core/src/api/llm.rs
  • crates/core/src/api/runtime/scope_stack.rs
  • crates/core/tests/unit/llm_api_tests.rs
**/*.{rs,py,go,js,ts}

📄 CodeRabbit inference engine (.agents/skills/validate-change/SKILL.md)

If a language surface changed, always run that language's test target even when Rust core did not change.

Files:

  • crates/core/tests/unit/context_tests.rs
  • crates/cli/tests/coverage/adapters_tests.rs
  • crates/core/src/api/runtime/state.rs
  • crates/cli/src/adapters/mod.rs
  • crates/core/tests/unit/observability/atof_tests.rs
  • crates/core/src/api/llm.rs
  • crates/core/src/api/runtime/scope_stack.rs
  • crates/core/tests/unit/llm_api_tests.rs
crates/{core,adaptive}/**/*.rs

⚙️ CodeRabbit configuration file

crates/{core,adaptive}/**/*.rs: Review the Rust runtime for async correctness, scope isolation, middleware ordering, and event lifecycle regressions.
Pay close attention to task-local/thread-local scope propagation, callback lifetimes, stream finalization, and root_uuid isolation.
Public API changes should preserve existing behavior unless tests and docs show the intended migration path.

Files:

  • crates/core/tests/unit/context_tests.rs
  • crates/core/src/api/runtime/state.rs
  • crates/core/tests/unit/observability/atof_tests.rs
  • crates/core/src/api/llm.rs
  • crates/core/src/api/runtime/scope_stack.rs
  • crates/core/tests/unit/llm_api_tests.rs
{crates/**/tests/**,python/tests/**,go/nemo_relay/**/*_test.go}

⚙️ CodeRabbit configuration file

{crates/**/tests/**,python/tests/**,go/nemo_relay/**/*_test.go}: Tests should cover the behavior promised by the changed API surface, including error paths and cross-request isolation where relevant.
Prefer assertions on lifecycle events, scope stacks, middleware ordering, and binding parity over shallow smoke tests.

Files:

  • crates/core/tests/unit/context_tests.rs
  • crates/cli/tests/coverage/adapters_tests.rs
  • crates/core/tests/unit/observability/atof_tests.rs
  • crates/core/tests/unit/llm_api_tests.rs
**/*.mdx

📄 CodeRabbit inference engine (.agents/skills/review-doc-style/SKILL.md)

MDX top-of-file SPDX comments must use {/* ... */} delimiters instead of HTML comment delimiters (Must-Fix)

In MDX files, top-of-file comments must use JSX comment delimiters ({/* to open and */} to close); do not use HTML comments for MDX SPDX headers

Files:

  • docs/nemo-relay-cli/codex.mdx
  • docs/instrument-applications/instrument-llm-call.mdx
  • docs/nemo-relay-cli/basic-usage.mdx
  • docs/configure-plugins/observability/atof.mdx
  • docs/nemo-relay-cli/claude-code.mdx
  • docs/about-nemo-relay/concepts/events.mdx
{docs,examples}/**/*

📄 CodeRabbit inference engine (.agents/skills/rename-surfaces/SKILL.md)

Update docs and examples.

Files:

  • docs/nemo-relay-cli/codex.mdx
  • docs/instrument-applications/instrument-llm-call.mdx
  • docs/nemo-relay-cli/basic-usage.mdx
  • docs/configure-plugins/observability/atof.mdx
  • docs/nemo-relay-cli/claude-code.mdx
  • docs/about-nemo-relay/concepts/events.mdx
docs/**/*

📄 CodeRabbit inference engine (.agents/skills/validate-change/SKILL.md)

If documentation examples or commands under docs/ change, run the targeted docs checks appropriate to the change.

Files:

  • docs/nemo-relay-cli/codex.mdx
  • docs/instrument-applications/instrument-llm-call.mdx
  • docs/nemo-relay-cli/basic-usage.mdx
  • docs/configure-plugins/observability/atof.mdx
  • docs/nemo-relay-cli/claude-code.mdx
  • docs/about-nemo-relay/concepts/events.mdx
{docs/**,README.md,CONTRIBUTING.md,RELEASING.md,SECURITY.md}

⚙️ CodeRabbit configuration file

{docs/**,README.md,CONTRIBUTING.md,RELEASING.md,SECURITY.md}: Review documentation for technical accuracy against the current API, command correctness, and consistency across language bindings.
Flag stale examples, missing SPDX headers where required, and instructions that no longer match CI or pre-commit behavior.

Files:

  • docs/nemo-relay-cli/codex.mdx
  • docs/instrument-applications/instrument-llm-call.mdx
  • docs/nemo-relay-cli/basic-usage.mdx
  • docs/configure-plugins/observability/atof.mdx
  • docs/nemo-relay-cli/claude-code.mdx
  • docs/about-nemo-relay/concepts/events.mdx
crates/core/src/api/runtime/state.rs

📄 CodeRabbit inference engine (.agents/skills/add-middleware/SKILL.md)

crates/core/src/api/runtime/state.rs: Add registry fields as SortedRegistry<GuardrailEntry<T>> or SortedRegistry<Intercept<T>> to NemoRelayContextState in crates/core/src/api/runtime/state.rs
Add chain execution helpers to NemoRelayContextState following the pattern of existing methods like tool_sanitize_request_chain or tool_request_intercepts_chain

Files:

  • crates/core/src/api/runtime/state.rs
crates/core/src/{api/**/*.rs,api/runtime/**/*.rs,codec/**/*.rs,json.rs}

📄 CodeRabbit inference engine (.agents/skills/add-binding-feature/SKILL.md)

Implement the new or changed public runtime behavior first in the Rust core, especially under crates/core/src/api/ and related core modules such as crates/core/src/api/runtime/, crates/core/src/codec/, and crates/core/src/json.rs.

Files:

  • crates/core/src/api/runtime/state.rs
  • crates/core/src/api/llm.rs
  • crates/core/src/api/runtime/scope_stack.rs
{crates/**/src/**/*.rs,python/**/*.py}

📄 CodeRabbit inference engine (.agents/skills/maintain-dynamic-plugins/SKILL.md)

Do not add tests under src; Rust tests belong in crate tests/ trees, and Python SDK tests belong under python/tests.

Files:

  • crates/core/src/api/runtime/state.rs
  • crates/cli/src/adapters/mod.rs
  • crates/core/src/api/llm.rs
  • crates/core/src/api/runtime/scope_stack.rs
crates/core/src/api/{tool,llm}.rs

📄 CodeRabbit inference engine (.agents/skills/add-middleware/SKILL.md)

Wire the new middleware chain into the execute path in crates/core/src/api/tool.rs or crates/core/src/api/llm.rs at the appropriate pipeline stage

Files:

  • crates/core/src/api/llm.rs
🔇 Additional comments (23)
crates/cli/src/adapters/mod.rs (1)

898-898: LGTM!

crates/cli/tests/coverage/adapters_tests.rs (1)

933-933: LGTM!

docs/nemo-relay-cli/basic-usage.mdx (1)

309-310: LGTM!

docs/nemo-relay-cli/claude-code.mdx (1)

125-129: LGTM!

docs/nemo-relay-cli/codex.mdx (1)

184-185: LGTM!

crates/core/tests/unit/llm_api_tests.rs (3)

14-42: LGTM!


58-89: LGTM!


288-397: LGTM!

Also applies to: 399-448, 451-611

crates/core/tests/unit/observability/atof_tests.rs (2)

12-45: LGTM!


1260-1347: LGTM!

docs/about-nemo-relay/concepts/events.mdx (1)

83-96: LGTM!

Also applies to: 111-113

docs/configure-plugins/observability/atof.mdx (1)

104-107: LGTM!

docs/instrument-applications/instrument-llm-call.mdx (1)

241-246: LGTM!

skills/nemo-relay-export-atif-trajectories/SKILL.md (1)

26-28: LGTM!

skills/nemo-relay-export-openinference/SKILL.md (1)

32-34: LGTM!

skills/nemo-relay-setup-observability/SKILL.md (1)

41-43: LGTM!

crates/core/src/api/runtime/scope_stack.rs (2)

12-12: LGTM!

Also applies to: 30-31, 45-49, 58-60, 144-144, 255-258


160-193: 🩺 Stability & Availability

Check scope-stack affinity for owning_agent_uuid(). take_full_llm_context() / rearm_full_llm_context() assume parent_uuid is resolved in the same ScopeStack instance that owns the agent scope. Confirm that compaction Mark emission and emit_llm_start_with_subscribers() never cross a task/thread boundary; otherwise the fallback can consume or re-arm the wrong baseline.

crates/core/src/api/runtime/state.rs (2)

29-29: LGTM!


194-199: 🗄️ Data Integrity & Integration

Centralize the compaction mark name
The compaction mark name should come from a shared constant used by both the runtime and the CLI adapter so the re-arm path can’t drift silently.

crates/core/tests/unit/context_tests.rs (1)

98-136: LGTM!

crates/core/src/api/llm.rs (2)

373-425: LGTM!

Also applies to: 488-501, 541-552


265-351: 🎯 Functional Correctness

Inspect the current-turn truncation helpers directly. The summary points to retain_current_user_turn and the limit_*_to_current_user_turn paths, but the implementation isn’t in the visible snippet. That logic decides whether prior-turn history is retained or dropped, so it needs a direct pass before relying on the change summary.

@mnajafian-nv mnajafian-nv left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I left four focused questions on contract consistency, concurrency, and compatibility. The post-sanitization projection direction looks sound; these comments are intended to make the breaking event contract consistent across every path before approval.

Comment thread crates/core/src/api/llm.rs Outdated
Comment thread crates/core/src/api/llm.rs Outdated
Comment thread crates/core/src/api/llm.rs Outdated
Comment thread crates/core/src/api/runtime/scope_stack.rs Outdated
@github-actions github-actions Bot added size:XL PR is extra large and removed size:L PR is large labels Jul 9, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@crates/core/src/api/llm.rs`:
- Around line 307-320: retain_current_user_turn currently drops instruction
messages in the no-user branch by draining everything before the last item,
which can collapse a system/developer/assistant history down to only the
assistant turn. Update the no-user path in retain_current_user_turn so
instruction messages are preserved consistently with the user-found branch, and
make sure the helper still only trims non-instruction history when appropriate.
Add a regression test covering a user-less history containing system and
developer messages to verify those instructions remain after calling
retain_current_user_turn.

In `@crates/core/tests/unit/llm_api_tests.rs`:
- Around line 537-600: Add a baseline Start-event assertion in
custom_request_codecs_project_convertible_histories so the codec-driven
managed-execution path verifies both requests. Keep the existing delta check,
but also locate the custom-codec-baseline event in the collected events and
assert that its projected conversation preserves the full 4-message history and
the annotated request reflects all messages, matching the behavior already
covered in the other history tests.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Enterprise

Run ID: 4edb5638-eebb-4a3b-84bc-ef2b5f596304

📥 Commits

Reviewing files that changed from the base of the PR and between 87aff4a and d09f97a.

📒 Files selected for processing (10)
  • crates/core/src/api/llm.rs
  • crates/core/src/api/runtime/scope_stack.rs
  • crates/core/src/api/runtime/state.rs
  • crates/core/src/codec/anthropic.rs
  • crates/core/src/codec/openai_chat.rs
  • crates/core/src/codec/openai_responses.rs
  • crates/core/src/codec/resolve.rs
  • crates/core/tests/unit/llm_api_tests.rs
  • docs/about-nemo-relay/concepts/events.mdx
  • docs/instrument-applications/instrument-llm-call.mdx
📜 Review details
⏰ Context from checks skipped due to timeout. (2)
  • GitHub Check: Check / Run
  • GitHub Check: Preview docs
🧰 Additional context used
📓 Path-based instructions (23)
**/*.rs

📄 CodeRabbit inference engine (.agents/skills/prepare-pr/SKILL.md)

**/*.rs: Any Rust change must run just test-rust
Any Rust change must run cargo fmt --all
Any Rust change must run cargo clippy --workspace --all-targets -- -D warnings

**/*.rs: Run cargo fmt --all for all FFI work since it is Rust work
Run just test-rust to validate FFI changes
Run cargo clippy --workspace --all-targets -- -D warnings to enforce strict linting on FFI work

When Rust files changed as part of Go work, also run cargo fmt --all, just test-rust, and cargo clippy --workspace --all-targets -- -D warnings

**/*.rs: Run cargo fmt --all when Rust files are changed as part of Node work
Run cargo clippy --workspace --all-targets -- -D warnings when Rust files are changed as part of Node work
Run just test-rust when Rust files are changed as part of Node work

When changing the core Rust runtime or Rust-facing API surface, format Rust code with cargo fmt (rustfmt defaults), keep cargo clippy -- -D warnings clean, and satisfy cargo deny check per deny.toml.

**/*.rs: If any Rust code changed, always run just test-rust.
If any Rust code changed, also run cargo fmt --all.
If any Rust code changed, also run cargo clippy --workspace --all-targets -- -D warnings.
For Rust changes headed for review, run cargo fmt --all and cargo clippy --workspace --all-targets -- -D warnings even if relying on pre-commit.

Files:

  • crates/core/src/codec/openai_chat.rs
  • crates/core/src/codec/openai_responses.rs
  • crates/core/src/codec/anthropic.rs
  • crates/core/src/codec/resolve.rs
  • crates/core/src/api/runtime/state.rs
  • crates/core/src/api/runtime/scope_stack.rs
  • crates/core/tests/unit/llm_api_tests.rs
  • crates/core/src/api/llm.rs
{crates/core,crates/adaptive}/**/*

📄 CodeRabbit inference engine (.agents/skills/prepare-pr/SKILL.md)

Changes to crates/core or crates/adaptive must run the full language matrix

Files:

  • crates/core/src/codec/openai_chat.rs
  • crates/core/src/codec/openai_responses.rs
  • crates/core/src/codec/anthropic.rs
  • crates/core/src/codec/resolve.rs
  • crates/core/src/api/runtime/state.rs
  • crates/core/src/api/runtime/scope_stack.rs
  • crates/core/tests/unit/llm_api_tests.rs
  • crates/core/src/api/llm.rs
crates/core/**/*.rs

📄 CodeRabbit inference engine (.agents/skills/test-go-binding/SKILL.md)

If the change touched crates/core or shared runtime semantics, also use validate-change for broader validation

Files:

  • crates/core/src/codec/openai_chat.rs
  • crates/core/src/codec/openai_responses.rs
  • crates/core/src/codec/anthropic.rs
  • crates/core/src/codec/resolve.rs
  • crates/core/src/api/runtime/state.rs
  • crates/core/src/api/runtime/scope_stack.rs
  • crates/core/tests/unit/llm_api_tests.rs
  • crates/core/src/api/llm.rs
**/*.{rs,py}

📄 CodeRabbit inference engine (AGENTS.md)

Follow binding naming conventions in Rust and Python: use snake_case.

Files:

  • crates/core/src/codec/openai_chat.rs
  • crates/core/src/codec/openai_responses.rs
  • crates/core/src/codec/anthropic.rs
  • crates/core/src/codec/resolve.rs
  • crates/core/src/api/runtime/state.rs
  • crates/core/src/api/runtime/scope_stack.rs
  • crates/core/tests/unit/llm_api_tests.rs
  • crates/core/src/api/llm.rs
**/*.{rs,py,js,mjs,cjs,ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

**/*.{rs,py,js,mjs,cjs,ts,tsx}: Use Json = serde_json::Value in Rust-facing runtime APIs where the existing code expects JSON payloads.
Use Result<T> with FlowError in core runtime paths, and keep errors explicit and binding-appropriate at the wrapper layer.
Keep async behavior on the existing tokio-based model; bindings should preserve callback and future lifetimes rather than blocking or hiding async work unexpectedly.

Files:

  • crates/core/src/codec/openai_chat.rs
  • crates/core/src/codec/openai_responses.rs
  • crates/core/src/codec/anthropic.rs
  • crates/core/src/codec/resolve.rs
  • crates/core/src/api/runtime/state.rs
  • crates/core/src/api/runtime/scope_stack.rs
  • crates/core/tests/unit/llm_api_tests.rs
  • crates/core/src/api/llm.rs
**/*.{rs,py,go,js,ts,c,h}

📄 CodeRabbit inference engine (CONTRIBUTING.md)

Use language-appropriate naming conventions: Rust snake_case, C FFI exports prefixed nemo_relay_, Go PascalCase, Node.js camelCase, and Python snake_case.

Files:

  • crates/core/src/codec/openai_chat.rs
  • crates/core/src/codec/openai_responses.rs
  • crates/core/src/codec/anthropic.rs
  • crates/core/src/codec/resolve.rs
  • crates/core/src/api/runtime/state.rs
  • crates/core/src/api/runtime/scope_stack.rs
  • crates/core/tests/unit/llm_api_tests.rs
  • crates/core/src/api/llm.rs
**/*.{rs,go,js,ts}

📄 CodeRabbit inference engine (CONTRIBUTING.md)

Add the SPDX license header to all Rust, Go, JavaScript, and TypeScript source files using the corresponding // comment form.

Files:

  • crates/core/src/codec/openai_chat.rs
  • crates/core/src/codec/openai_responses.rs
  • crates/core/src/codec/anthropic.rs
  • crates/core/src/codec/resolve.rs
  • crates/core/src/api/runtime/state.rs
  • crates/core/src/api/runtime/scope_stack.rs
  • crates/core/tests/unit/llm_api_tests.rs
  • crates/core/src/api/llm.rs
crates/core/src/{api/**/*.rs,api/runtime/**/*.rs,codec/**/*.rs,json.rs}

📄 CodeRabbit inference engine (.agents/skills/add-binding-feature/SKILL.md)

Implement the new or changed public runtime behavior first in the Rust core, especially under crates/core/src/api/ and related core modules such as crates/core/src/api/runtime/, crates/core/src/codec/, and crates/core/src/json.rs.

Files:

  • crates/core/src/codec/openai_chat.rs
  • crates/core/src/codec/openai_responses.rs
  • crates/core/src/codec/anthropic.rs
  • crates/core/src/codec/resolve.rs
  • crates/core/src/api/runtime/state.rs
  • crates/core/src/api/runtime/scope_stack.rs
  • crates/core/src/api/llm.rs
{crates/**/src/**/*.rs,python/**/*.py}

📄 CodeRabbit inference engine (.agents/skills/maintain-dynamic-plugins/SKILL.md)

Do not add tests under src; Rust tests belong in crate tests/ trees, and Python SDK tests belong under python/tests.

Files:

  • crates/core/src/codec/openai_chat.rs
  • crates/core/src/codec/openai_responses.rs
  • crates/core/src/codec/anthropic.rs
  • crates/core/src/codec/resolve.rs
  • crates/core/src/api/runtime/state.rs
  • crates/core/src/api/runtime/scope_stack.rs
  • crates/core/src/api/llm.rs
**/*

📄 CodeRabbit inference engine (.agents/skills/validate-change/SKILL.md)

**/*: Format changed files with the language-native formatter before the final lint/test pass.
If dynamic plugin behavior changed, use maintain-dynamic-plugins and include the native SDK, worker protocol, Python SDK, docs, packaging, and Codecov surfaces in the validation plan.
If code changes alter APIs, bindings, commands, paths, packaging behavior, observability/adaptive semantics, or documented best practices, update any dependent maintainer or consumer skills in the same branch.
During iteration, prefer uv run pre-commit run --files <changed files...>.
Before review or handoff, run uv run pre-commit run --all-files.

Files:

  • crates/core/src/codec/openai_chat.rs
  • docs/instrument-applications/instrument-llm-call.mdx
  • crates/core/src/codec/openai_responses.rs
  • crates/core/src/codec/anthropic.rs
  • docs/about-nemo-relay/concepts/events.mdx
  • crates/core/src/codec/resolve.rs
  • crates/core/src/api/runtime/state.rs
  • crates/core/src/api/runtime/scope_stack.rs
  • crates/core/tests/unit/llm_api_tests.rs
  • crates/core/src/api/llm.rs
crates/{core,adaptive}/**/*

📄 CodeRabbit inference engine (.agents/skills/validate-change/SKILL.md)

If crates/core or crates/adaptive changed, run the full validation matrix across Rust, Python, Go, and Node.js.

Files:

  • crates/core/src/codec/openai_chat.rs
  • crates/core/src/codec/openai_responses.rs
  • crates/core/src/codec/anthropic.rs
  • crates/core/src/codec/resolve.rs
  • crates/core/src/api/runtime/state.rs
  • crates/core/src/api/runtime/scope_stack.rs
  • crates/core/tests/unit/llm_api_tests.rs
  • crates/core/src/api/llm.rs
**/*.{rs,py,go,js,ts}

📄 CodeRabbit inference engine (.agents/skills/validate-change/SKILL.md)

If a language surface changed, always run that language's test target even when Rust core did not change.

Files:

  • crates/core/src/codec/openai_chat.rs
  • crates/core/src/codec/openai_responses.rs
  • crates/core/src/codec/anthropic.rs
  • crates/core/src/codec/resolve.rs
  • crates/core/src/api/runtime/state.rs
  • crates/core/src/api/runtime/scope_stack.rs
  • crates/core/tests/unit/llm_api_tests.rs
  • crates/core/src/api/llm.rs
**

⚙️ CodeRabbit configuration file

**:

AGENTS.md

This file provides guidance to agents, including Claude Code and OpenAI Codex, when working in this repository.

Project Overview

NeMo Relay is a multi-language agent runtime framework for execution scopes, lifecycle events, middleware, plugins, and observability around tool and LLM calls. The core runtime is Rust. Primary supported bindings are Rust, Python, and Node.js. Go and the raw C FFI are experimental and source-first.

The shared runtime model is:

  1. Scope stacks decide where work belongs and which scope-local behavior is visible.
  2. Middleware registries decide what guardrails and intercepts run around managed calls.
  3. Plugins install reusable runtime behavior from configuration.
  4. Events record runtime behavior in ATOF form.
  5. Subscribers and exporters consume events in-process or export them to ATIF, OpenTelemetry, OpenInference, or other backends.

Repository Structure

The repository layout separates the Rust runtime, language bindings,
documentation, integrations, and agent-facing skills.

crates/
  core/       # Rust core runtime crate, published as nemo-relay
  adaptive/   # Adaptive runtime primitives and plugin components
  python/     # PyO3 native extension for the Python package
  ffi/        # Raw C ABI layer used by downstream bindings such as Go
  node/       # NAPI Node.js binding and JavaScript/TypeScript entry points
python/
  nemo_relay/  # Python wrapper package: scopes, tools, LLM, middleware, typed helpers, plugins, adaptive helpers
  tests/      # Python tests
go/
  nemo_relay/  # Experimental Go CGo binding and tests
fern/         # Fern documentation site
scripts/      # Stable wrappers and helper scripts; build/test/docs entry points live in justfile
skills/       # Published Codex/agent skills for NeMo Relay usage patterns

Prerequisites

Insta...

Files:

  • crates/core/src/codec/openai_chat.rs
  • docs/instrument-applications/instrument-llm-call.mdx
  • crates/core/src/codec/openai_responses.rs
  • crates/core/src/codec/anthropic.rs
  • docs/about-nemo-relay/concepts/events.mdx
  • crates/core/src/codec/resolve.rs
  • crates/core/src/api/runtime/state.rs
  • crates/core/src/api/runtime/scope_stack.rs
  • crates/core/tests/unit/llm_api_tests.rs
  • crates/core/src/api/llm.rs
crates/{core,adaptive}/**/*.rs

⚙️ CodeRabbit configuration file

crates/{core,adaptive}/**/*.rs: Review the Rust runtime for async correctness, scope isolation, middleware ordering, and event lifecycle regressions.
Pay close attention to task-local/thread-local scope propagation, callback lifetimes, stream finalization, and root_uuid isolation.
Public API changes should preserve existing behavior unless tests and docs show the intended migration path.

Files:

  • crates/core/src/codec/openai_chat.rs
  • crates/core/src/codec/openai_responses.rs
  • crates/core/src/codec/anthropic.rs
  • crates/core/src/codec/resolve.rs
  • crates/core/src/api/runtime/state.rs
  • crates/core/src/api/runtime/scope_stack.rs
  • crates/core/tests/unit/llm_api_tests.rs
  • crates/core/src/api/llm.rs
**/*.mdx

📄 CodeRabbit inference engine (.agents/skills/review-doc-style/SKILL.md)

MDX top-of-file SPDX comments must use {/* ... */} delimiters instead of HTML comment delimiters (Must-Fix)

In MDX files, top-of-file comments must use JSX comment delimiters ({/* to open and */} to close); do not use HTML comments for MDX SPDX headers

Files:

  • docs/instrument-applications/instrument-llm-call.mdx
  • docs/about-nemo-relay/concepts/events.mdx
**/*.{md,mdx}

📄 CodeRabbit inference engine (AGENTS.md)

Update README.md, fern/, package READMEs, and binding-support notes when public behavior, package names, examples, or supported bindings change.

**/*.{md,mdx}: Prefer the documented public API, not internal shortcuts
Keep package names, repo references, and build commands current
Keep release-process and release-notes guidance in repo-maintainer docs such as RELEASING.md, not as user-facing docs pages or CHANGELOG.md
Keep stable user-facing wrappers at scripts/ root in docs and examples; only point at namespaced helper paths when documenting internal maintenance work
When detailed dynamic plugin guides exist, keep Rust native plugin examples, Python worker plugin examples, and grpc-v1 protocol details on separate pages

If links in documentation change, run just docs-linkcheck.

Files:

  • docs/instrument-applications/instrument-llm-call.mdx
  • docs/about-nemo-relay/concepts/events.mdx
**/*.{md,markdown,mdx}

📄 CodeRabbit inference engine (CONTRIBUTING.md)

Add the SPDX license header to all Markdown/MDX documentation files using the HTML comment block form.

Files:

  • docs/instrument-applications/instrument-llm-call.mdx
  • docs/about-nemo-relay/concepts/events.mdx
{docs,examples}/**/*

📄 CodeRabbit inference engine (.agents/skills/rename-surfaces/SKILL.md)

Update docs and examples.

Files:

  • docs/instrument-applications/instrument-llm-call.mdx
  • docs/about-nemo-relay/concepts/events.mdx
docs/**/*

📄 CodeRabbit inference engine (.agents/skills/validate-change/SKILL.md)

If documentation examples or commands under docs/ change, run the targeted docs checks appropriate to the change.

Files:

  • docs/instrument-applications/instrument-llm-call.mdx
  • docs/about-nemo-relay/concepts/events.mdx
{docs/**,README.md,CONTRIBUTING.md,RELEASING.md,SECURITY.md}

⚙️ CodeRabbit configuration file

{docs/**,README.md,CONTRIBUTING.md,RELEASING.md,SECURITY.md}: Review documentation for technical accuracy against the current API, command correctness, and consistency across language bindings.
Flag stale examples, missing SPDX headers where required, and instructions that no longer match CI or pre-commit behavior.

Files:

  • docs/instrument-applications/instrument-llm-call.mdx
  • docs/about-nemo-relay/concepts/events.mdx
crates/core/src/api/runtime/state.rs

📄 CodeRabbit inference engine (.agents/skills/add-middleware/SKILL.md)

crates/core/src/api/runtime/state.rs: Add registry fields as SortedRegistry<GuardrailEntry<T>> or SortedRegistry<Intercept<T>> to NemoRelayContextState in crates/core/src/api/runtime/state.rs
Add chain execution helpers to NemoRelayContextState following the pattern of existing methods like tool_sanitize_request_chain or tool_request_intercepts_chain

Files:

  • crates/core/src/api/runtime/state.rs
{crates/**/tests/**,python/tests/**,go/nemo_relay/**/*_test.go}

⚙️ CodeRabbit configuration file

{crates/**/tests/**,python/tests/**,go/nemo_relay/**/*_test.go}: Tests should cover the behavior promised by the changed API surface, including error paths and cross-request isolation where relevant.
Prefer assertions on lifecycle events, scope stacks, middleware ordering, and binding parity over shallow smoke tests.

Files:

  • crates/core/tests/unit/llm_api_tests.rs
crates/core/src/api/{tool,llm}.rs

📄 CodeRabbit inference engine (.agents/skills/add-middleware/SKILL.md)

Wire the new middleware chain into the execute path in crates/core/src/api/tool.rs or crates/core/src/api/llm.rs at the appropriate pipeline stage

Files:

  • crates/core/src/api/llm.rs
🔇 Additional comments (18)
docs/about-nemo-relay/concepts/events.mdx (1)

94-97: LGTM!

Also applies to: 115-117

docs/instrument-applications/instrument-llm-call.mdx (1)

247-250: LGTM!

crates/core/src/api/runtime/scope_stack.rs (1)

46-51: LGTM!

Also applies to: 60-64, 148-149, 165-209, 271-278

crates/core/src/api/runtime/state.rs (2)

548-576: LGTM!


196-201: 🩺 Stability & Availability

Confirm compaction marks rearm the originating agent
Compaction marks should only call rearm_full_llm_context(event.parent_uuid()) when the active current_scope_stack() is guaranteed to contain that parent agent; otherwise the fallback can arm the wrong baseline for the next LLM call.

crates/core/src/api/llm.rs (1)

486-506: LGTM!

crates/core/src/codec/resolve.rs (1)

50-50: LGTM!

Also applies to: 137-146

crates/core/src/codec/anthropic.rs (1)

58-58: LGTM!

crates/core/src/codec/openai_chat.rs (1)

35-35: LGTM!

crates/core/src/codec/openai_responses.rs (1)

50-50: LGTM!

crates/core/tests/unit/llm_api_tests.rs (8)

8-38: LGTM!

Also applies to: 50-61


78-154: LGTM!

ConversationCodec and HistoryResponseCodec correctly round-trip through OpenAIChatCodec and populate the extra catch-all, matching the annotated request/response contract used elsewhere in the suite.


157-350: LGTM!

Solid coverage: baseline-then-delta projection, Arc copy-on-write isolation between the first (full-baseline) and second (reduced) Start events, and preservation of metadata/tools/content/output/usage fields in bounded events.


502-535: LGTM!

Good coverage of no-op edge cases: empty history, opaque/non-matching message shapes, and scalar input — all correctly assert no mutation.


615-666: LGTM!

Manual, managed, and streaming end-path projections are exercised consistently, including annotated-response extra.messages reduction for the codec-backed cases.


712-807: LGTM!

The emission-gate/mutex-holding design is correctly exploited here: the second thread can't reach its own sanitize-start guardrail until the first thread's entire emit_llm_start_with_subscribers call (including subscriber push) completes, which is exactly what's needed to prove reserved-baseline-before-delta ordering under concurrency.


490-500: 🎯 Functional Correctness

Confirm the no-user fallback for assistant/tool turns. The current expectation drops the assistant message and keeps only the trailing tool result. If a no-user-boundary response is still meant to preserve tool context, this fallback should retain the assistant half of the pair or be documented explicitly.


667-710: 🗄️ Data Integrity & Integration

Check the failure-path end output projection. The failed-history-end case relies on .data(multi_turn_response()), but LlmCallExecuteParams::data is documented as handle-only state. Confirm emit_llm_end_without_output is meant to project that payload into end.output() on failure, and that this assertion cannot be None.

Comment thread crates/core/src/api/llm.rs Outdated
Comment thread crates/core/tests/unit/llm_api_tests.rs Outdated
Comment thread crates/core/src/api/llm.rs Outdated
Comment thread crates/core/src/api/llm.rs Outdated
@github-actions github-actions Bot added size:L PR is large and removed size:XL PR is extra large labels Jul 10, 2026
@willkill07 willkill07 changed the title feat(events)!: bound LLM history with context baselines feat(events)!: cull stale annotated LLM histories Jul 10, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 4

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@crates/core/src/api/llm.rs`:
- Around line 326-336: Update project_llm_request_to_current_user_turn to avoid
eagerly cloning AnnotatedLlmRequest via as_deref().cloned(). Use Arc::make_mut
on the existing Arc and apply
limit_annotated_request_history_to_current_user_turn in place, preserving the
Option/Arc structure and relying on copy-on-write only when the Arc is shared.

In `@crates/core/src/api/scope.rs`:
- Line 336: Replace the duplicated "compaction" event-name literals with a
shared constant, defining it in the appropriate common module and importing it
where needed. Update the comparison in the scope logic, normalization in the
adapters module, and related tests to reference this constant.
- Around line 331-338: In event(), avoid taking the scope stack write lock for
non-compaction events: use the existing read-only access path to collect
subscribers and reserve the write lock only when params.name == "compaction" so
mark_agent_fresh(parent_uuid) can mutate safely. Preserve
snapshot_event_subscribers behavior and ensure both branches produce the same
event/subscriber result.

In `@crates/core/tests/unit/llm_api_tests.rs`:
- Around line 357-409: Expand coverage around emit_llm_start_with_subscribers to
add a separate concurrent-start test that records dispatch order and asserts it
matches freshness reservation order, while retaining the existing exactly-once
[2, 4] assertion. Use the subscriber’s captured lifecycle events and
synchronization primitives to make the ordering check deterministic, and keep
concurrent_starts_consume_freshness_exactly_once_without_ordering focused only
on uniqueness.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Enterprise

Run ID: 6e9458b2-bb22-4e9b-8cef-b474cebeefd2

📥 Commits

Reviewing files that changed from the base of the PR and between 0171a7d and 9335871.

📒 Files selected for processing (16)
  • crates/cli/src/adapters/mod.rs
  • crates/cli/tests/coverage/adapters_tests.rs
  • crates/core/src/api/llm.rs
  • crates/core/src/api/runtime/scope_stack.rs
  • crates/core/src/api/scope.rs
  • crates/core/tests/unit/context_tests.rs
  • crates/core/tests/unit/llm_api_tests.rs
  • docs/about-nemo-relay/concepts/events.mdx
  • docs/configure-plugins/observability/atof.mdx
  • docs/instrument-applications/instrument-llm-call.mdx
  • docs/nemo-relay-cli/basic-usage.mdx
  • docs/nemo-relay-cli/claude-code.mdx
  • docs/nemo-relay-cli/codex.mdx
  • skills/nemo-relay-export-atif-trajectories/SKILL.md
  • skills/nemo-relay-export-openinference/SKILL.md
  • skills/nemo-relay-setup-observability/SKILL.md
📜 Review details
⏰ Context from checks skipped due to timeout. (3)
  • GitHub Check: Check / Run
  • GitHub Check: CodeRabbit / Review
  • GitHub Check: Preview docs
🧰 Additional context used
📓 Path-based instructions (28)
**/*.rs

📄 CodeRabbit inference engine (.agents/skills/prepare-pr/SKILL.md)

**/*.rs: Any Rust change must run just test-rust
Any Rust change must run cargo fmt --all
Any Rust change must run cargo clippy --workspace --all-targets -- -D warnings

**/*.rs: Run cargo fmt --all for all FFI work since it is Rust work
Run just test-rust to validate FFI changes
Run cargo clippy --workspace --all-targets -- -D warnings to enforce strict linting on FFI work

When Rust files changed as part of Go work, also run cargo fmt --all, just test-rust, and cargo clippy --workspace --all-targets -- -D warnings

**/*.rs: Run cargo fmt --all when Rust files are changed as part of Node work
Run cargo clippy --workspace --all-targets -- -D warnings when Rust files are changed as part of Node work
Run just test-rust when Rust files are changed as part of Node work

When changing the core Rust runtime or Rust-facing API surface, format Rust code with cargo fmt (rustfmt defaults), keep cargo clippy -- -D warnings clean, and satisfy cargo deny check per deny.toml.

**/*.rs: If any Rust code changed, always run just test-rust.
If any Rust code changed, also run cargo fmt --all.
If any Rust code changed, also run cargo clippy --workspace --all-targets -- -D warnings.
For Rust changes headed for review, run cargo fmt --all and cargo clippy --workspace --all-targets -- -D warnings even if relying on pre-commit.

Files:

  • crates/cli/tests/coverage/adapters_tests.rs
  • crates/core/tests/unit/context_tests.rs
  • crates/cli/src/adapters/mod.rs
  • crates/core/src/api/scope.rs
  • crates/core/src/api/llm.rs
  • crates/core/tests/unit/llm_api_tests.rs
  • crates/core/src/api/runtime/scope_stack.rs
**/*.{rs,py}

📄 CodeRabbit inference engine (AGENTS.md)

Follow binding naming conventions in Rust and Python: use snake_case.

Files:

  • crates/cli/tests/coverage/adapters_tests.rs
  • crates/core/tests/unit/context_tests.rs
  • crates/cli/src/adapters/mod.rs
  • crates/core/src/api/scope.rs
  • crates/core/src/api/llm.rs
  • crates/core/tests/unit/llm_api_tests.rs
  • crates/core/src/api/runtime/scope_stack.rs
**/*.{rs,py,js,mjs,cjs,ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

**/*.{rs,py,js,mjs,cjs,ts,tsx}: Use Json = serde_json::Value in Rust-facing runtime APIs where the existing code expects JSON payloads.
Use Result<T> with FlowError in core runtime paths, and keep errors explicit and binding-appropriate at the wrapper layer.
Keep async behavior on the existing tokio-based model; bindings should preserve callback and future lifetimes rather than blocking or hiding async work unexpectedly.

Files:

  • crates/cli/tests/coverage/adapters_tests.rs
  • crates/core/tests/unit/context_tests.rs
  • crates/cli/src/adapters/mod.rs
  • crates/core/src/api/scope.rs
  • crates/core/src/api/llm.rs
  • crates/core/tests/unit/llm_api_tests.rs
  • crates/core/src/api/runtime/scope_stack.rs
**/*.{rs,py,go,js,ts,c,h}

📄 CodeRabbit inference engine (CONTRIBUTING.md)

Use language-appropriate naming conventions: Rust snake_case, C FFI exports prefixed nemo_relay_, Go PascalCase, Node.js camelCase, and Python snake_case.

Files:

  • crates/cli/tests/coverage/adapters_tests.rs
  • crates/core/tests/unit/context_tests.rs
  • crates/cli/src/adapters/mod.rs
  • crates/core/src/api/scope.rs
  • crates/core/src/api/llm.rs
  • crates/core/tests/unit/llm_api_tests.rs
  • crates/core/src/api/runtime/scope_stack.rs
**/*.{rs,go,js,ts}

📄 CodeRabbit inference engine (CONTRIBUTING.md)

Add the SPDX license header to all Rust, Go, JavaScript, and TypeScript source files using the corresponding // comment form.

Files:

  • crates/cli/tests/coverage/adapters_tests.rs
  • crates/core/tests/unit/context_tests.rs
  • crates/cli/src/adapters/mod.rs
  • crates/core/src/api/scope.rs
  • crates/core/src/api/llm.rs
  • crates/core/tests/unit/llm_api_tests.rs
  • crates/core/src/api/runtime/scope_stack.rs
**/*

📄 CodeRabbit inference engine (.agents/skills/validate-change/SKILL.md)

**/*: Format changed files with the language-native formatter before the final lint/test pass.
If dynamic plugin behavior changed, use maintain-dynamic-plugins and include the native SDK, worker protocol, Python SDK, docs, packaging, and Codecov surfaces in the validation plan.
If code changes alter APIs, bindings, commands, paths, packaging behavior, observability/adaptive semantics, or documented best practices, update any dependent maintainer or consumer skills in the same branch.
During iteration, prefer uv run pre-commit run --files <changed files...>.
Before review or handoff, run uv run pre-commit run --all-files.

Files:

  • crates/cli/tests/coverage/adapters_tests.rs
  • skills/nemo-relay-setup-observability/SKILL.md
  • crates/core/tests/unit/context_tests.rs
  • docs/nemo-relay-cli/basic-usage.mdx
  • docs/instrument-applications/instrument-llm-call.mdx
  • skills/nemo-relay-export-atif-trajectories/SKILL.md
  • skills/nemo-relay-export-openinference/SKILL.md
  • docs/nemo-relay-cli/claude-code.mdx
  • docs/nemo-relay-cli/codex.mdx
  • docs/about-nemo-relay/concepts/events.mdx
  • crates/cli/src/adapters/mod.rs
  • crates/core/src/api/scope.rs
  • docs/configure-plugins/observability/atof.mdx
  • crates/core/src/api/llm.rs
  • crates/core/tests/unit/llm_api_tests.rs
  • crates/core/src/api/runtime/scope_stack.rs
**/*.{rs,py,go,js,ts}

📄 CodeRabbit inference engine (.agents/skills/validate-change/SKILL.md)

If a language surface changed, always run that language's test target even when Rust core did not change.

Files:

  • crates/cli/tests/coverage/adapters_tests.rs
  • crates/core/tests/unit/context_tests.rs
  • crates/cli/src/adapters/mod.rs
  • crates/core/src/api/scope.rs
  • crates/core/src/api/llm.rs
  • crates/core/tests/unit/llm_api_tests.rs
  • crates/core/src/api/runtime/scope_stack.rs
**

⚙️ CodeRabbit configuration file

**:

AGENTS.md

This file provides guidance to agents, including Claude Code and OpenAI Codex, when working in this repository.

Project Overview

NeMo Relay is a multi-language agent runtime framework for execution scopes, lifecycle events, middleware, plugins, and observability around tool and LLM calls. The core runtime is Rust. Primary supported bindings are Rust, Python, and Node.js. Go and the raw C FFI are experimental and source-first.

The shared runtime model is:

  1. Scope stacks decide where work belongs and which scope-local behavior is visible.
  2. Middleware registries decide what guardrails and intercepts run around managed calls.
  3. Plugins install reusable runtime behavior from configuration.
  4. Events record runtime behavior in ATOF form.
  5. Subscribers and exporters consume events in-process or export them to ATIF, OpenTelemetry, OpenInference, or other backends.

Repository Structure

The repository layout separates the Rust runtime, language bindings,
documentation, integrations, and agent-facing skills.

crates/
  core/       # Rust core runtime crate, published as nemo-relay
  adaptive/   # Adaptive runtime primitives and plugin components
  python/     # PyO3 native extension for the Python package
  ffi/        # Raw C ABI layer used by downstream bindings such as Go
  node/       # NAPI Node.js binding and JavaScript/TypeScript entry points
python/
  nemo_relay/  # Python wrapper package: scopes, tools, LLM, middleware, typed helpers, plugins, adaptive helpers
  tests/      # Python tests
go/
  nemo_relay/  # Experimental Go CGo binding and tests
fern/         # Fern documentation site
scripts/      # Stable wrappers and helper scripts; build/test/docs entry points live in justfile
skills/       # Published Codex/agent skills for NeMo Relay usage patterns

Prerequisites

Insta...

Files:

  • crates/cli/tests/coverage/adapters_tests.rs
  • skills/nemo-relay-setup-observability/SKILL.md
  • crates/core/tests/unit/context_tests.rs
  • docs/nemo-relay-cli/basic-usage.mdx
  • docs/instrument-applications/instrument-llm-call.mdx
  • skills/nemo-relay-export-atif-trajectories/SKILL.md
  • skills/nemo-relay-export-openinference/SKILL.md
  • docs/nemo-relay-cli/claude-code.mdx
  • docs/nemo-relay-cli/codex.mdx
  • docs/about-nemo-relay/concepts/events.mdx
  • crates/cli/src/adapters/mod.rs
  • crates/core/src/api/scope.rs
  • docs/configure-plugins/observability/atof.mdx
  • crates/core/src/api/llm.rs
  • crates/core/tests/unit/llm_api_tests.rs
  • crates/core/src/api/runtime/scope_stack.rs
{crates/**/tests/**,python/tests/**,go/nemo_relay/**/*_test.go}

⚙️ CodeRabbit configuration file

{crates/**/tests/**,python/tests/**,go/nemo_relay/**/*_test.go}: Tests should cover the behavior promised by the changed API surface, including error paths and cross-request isolation where relevant.
Prefer assertions on lifecycle events, scope stacks, middleware ordering, and binding parity over shallow smoke tests.

Files:

  • crates/cli/tests/coverage/adapters_tests.rs
  • crates/core/tests/unit/context_tests.rs
  • crates/core/tests/unit/llm_api_tests.rs
**/*.{md,rst,html,txt}

📄 CodeRabbit inference engine (.agents/skills/review-doc-style/assets/nvidia-style-brand-terminology.md)

**/*.{md,rst,html,txt}: Always spell NVIDIA in all caps. Do not use Nvidia, nvidia, nVidia, nVIDIA, or NV.
Use an NVIDIA before a noun because the name starts with an 'en' sound.
Do not add a registered trademark symbol after NVIDIA when referring to the company.
Use trademark symbols with product names only when the document type or legal guidance requires them.
Verify official capitalization, spacing, and hyphenation for product names.
Precede NVIDIA product names with NVIDIA on first mention when it is natural and accurate.
Do not rewrite product names for grammar or title-case rules.
Preserve third-party product names according to the owner's spelling.
Include the company name and full model qualifier on first use when it helps identify the model.
Preserve the official capitalization and punctuation of model names.
Use shorter family names only after the full name is established.
Spell out a term on first use and put the acronym in parentheses unless the acronym is widely understood by the intended audience.
Use the acronym on later mentions after it has been defined.
For long documents, reintroduce the full term if readers might lose context.
Form plurals of acronyms with s, not an apostrophe, such as GPUs.
In headings, common acronyms can remain abbreviated. Spell out the term in the first or second sentence of the body.
Common terms such as CPU, GPU, PC, API, and UI usually do not need to be spelled out for developer audiences.

Files:

  • skills/nemo-relay-setup-observability/SKILL.md
  • skills/nemo-relay-export-atif-trajectories/SKILL.md
  • skills/nemo-relay-export-openinference/SKILL.md
**/*.{md,rst,html}

📄 CodeRabbit inference engine (.agents/skills/review-doc-style/assets/nvidia-style-brand-terminology.md)

Link the first mention of a product name when the destination helps the reader.

Files:

  • skills/nemo-relay-setup-observability/SKILL.md
  • skills/nemo-relay-export-atif-trajectories/SKILL.md
  • skills/nemo-relay-export-openinference/SKILL.md
**/*.{md,rst,txt}

📄 CodeRabbit inference engine (.agents/skills/review-doc-style/assets/nvidia-style-guide.md)

Spell NVIDIA in all caps. Do not use Nvidia, nvidia, or NV.

Files:

  • skills/nemo-relay-setup-observability/SKILL.md
  • skills/nemo-relay-export-atif-trajectories/SKILL.md
  • skills/nemo-relay-export-openinference/SKILL.md
**/*.{md,rst}

📄 CodeRabbit inference engine (.agents/skills/review-doc-style/assets/nvidia-style-guide.md)

**/*.{md,rst}: Format commands, code elements, expressions, package names, file names, and paths as inline code.
Use descriptive link text. Avoid raw URLs and weak anchors such as "here" or "read more."
Use title case consistently for technical documentation headings.
Introduce code blocks, lists, tables, and images with complete sentences.
Write procedures as imperative steps. Keep steps parallel and split long procedures into smaller tasks.
Prefer active voice, present tense, short sentences, contractions, and plain English.
Use can for possibility and reserve may for permission.
Use after for temporal relationships instead of once.
Prefer refer to over see when the wording points readers to another resource.
Avoid culture-specific idioms, unnecessary Latinisms, jokes, and marketing exaggeration in technical docs.
Spell out months in body text, avoid ordinal dates, and use clear time zones.
Spell out whole numbers from zero through nine unless they are technical values, parameters, versions, or UI values.
Use numerals for 10 or greater and include commas in thousands.
Do not add trademark symbols to learning-oriented docs unless the source, platform, or legal guidance explicitly requires them.

Files:

  • skills/nemo-relay-setup-observability/SKILL.md
  • skills/nemo-relay-export-atif-trajectories/SKILL.md
  • skills/nemo-relay-export-openinference/SKILL.md
**/*.md

📄 CodeRabbit inference engine (.agents/skills/review-doc-style/assets/nvidia-style-technical-docs.md)

**/*.md: Use title case consistently in technical documentation headings
Avoid quotation marks, ampersands, and exclamation marks in headings
Keep product, event, research, and whitepaper names in their official title case
Use title case for table headers
Do not force social-media sentence case into technical docs
Format code elements, commands, parameters, package names, and expressions in monospace
Format directories, file names, and paths in monospace using backticks
Use angle brackets inside monospace for variables inside paths, such as /home/<username>/.login
Format error messages and strings in quotation marks, keeping literal code strings in code formatting when clearer
Format UI buttons, menus, fields, and labels in bold
Use angle brackets between UI labels for menu paths, such as File > Save As
Use italics for new terms on first use, sparingly and only when introducing the term
Use italics for publication titles
Format keyboard shortcuts in plain text, such as Press Ctrl+Alt+Delete
Use owner/repo link text for GitHub repositories, preferring [NVIDIA/NeMo](link) over prose references like 'the GitHub repo'
Introduce every code block with a complete sentence
Do not make a code block complete the grammar of the previous sentence
Do not continue a sentence after a code block
Use syntax highlighting when the format supports it for code blocks
Avoid the word 'snippet' unless the surrounding docs already use it as a term of art
Keep inline method, function, and class references consistent with nearby docs, omitting empty parentheses for prose readability when no call is shown
Use descriptive anchor text that matches the destination title when possible for links
Avoid raw URLs in running text
Avoid generic anchor text such as 'here,' 'this page,' and 'read more'
Include acronyms in link text when a linked term includes an acronym
Do not link long sentences or multiple sentences
Avoid links that pull readers away from a procedure unless the link is a p...

Files:

  • skills/nemo-relay-setup-observability/SKILL.md
  • skills/nemo-relay-export-atif-trajectories/SKILL.md
  • skills/nemo-relay-export-openinference/SKILL.md
**/SKILL.md

📄 CodeRabbit inference engine (AGENTS.md)

SKILL.md files are skill entrypoints and must start with YAML frontmatter containing at least name and description.

Files:

  • skills/nemo-relay-setup-observability/SKILL.md
  • skills/nemo-relay-export-atif-trajectories/SKILL.md
  • skills/nemo-relay-export-openinference/SKILL.md

⚙️ CodeRabbit configuration file

**/SKILL.md: Do not flag SKILL.md files for missing SPDX headers. Skill entrypoints intentionally start with YAML frontmatter instead.
Verify that every SKILL.md keeps valid YAML frontmatter with at least name and description fields before the Markdown body.

Files:

  • skills/nemo-relay-setup-observability/SKILL.md
  • skills/nemo-relay-export-atif-trajectories/SKILL.md
  • skills/nemo-relay-export-openinference/SKILL.md
**/*.{md,mdx}

📄 CodeRabbit inference engine (AGENTS.md)

Update README.md, fern/, package READMEs, and binding-support notes when public behavior, package names, examples, or supported bindings change.

**/*.{md,mdx}: Prefer the documented public API, not internal shortcuts
Keep package names, repo references, and build commands current
Keep release-process and release-notes guidance in repo-maintainer docs such as RELEASING.md, not as user-facing docs pages or CHANGELOG.md
Keep stable user-facing wrappers at scripts/ root in docs and examples; only point at namespaced helper paths when documenting internal maintenance work
When detailed dynamic plugin guides exist, keep Rust native plugin examples, Python worker plugin examples, and grpc-v1 protocol details on separate pages

If links in documentation change, run just docs-linkcheck.

Files:

  • skills/nemo-relay-setup-observability/SKILL.md
  • docs/nemo-relay-cli/basic-usage.mdx
  • docs/instrument-applications/instrument-llm-call.mdx
  • skills/nemo-relay-export-atif-trajectories/SKILL.md
  • skills/nemo-relay-export-openinference/SKILL.md
  • docs/nemo-relay-cli/claude-code.mdx
  • docs/nemo-relay-cli/codex.mdx
  • docs/about-nemo-relay/concepts/events.mdx
  • docs/configure-plugins/observability/atof.mdx
**/*.{md,markdown,mdx}

📄 CodeRabbit inference engine (CONTRIBUTING.md)

Add the SPDX license header to all Markdown/MDX documentation files using the HTML comment block form.

Files:

  • skills/nemo-relay-setup-observability/SKILL.md
  • docs/nemo-relay-cli/basic-usage.mdx
  • docs/instrument-applications/instrument-llm-call.mdx
  • skills/nemo-relay-export-atif-trajectories/SKILL.md
  • skills/nemo-relay-export-openinference/SKILL.md
  • docs/nemo-relay-cli/claude-code.mdx
  • docs/nemo-relay-cli/codex.mdx
  • docs/about-nemo-relay/concepts/events.mdx
  • docs/configure-plugins/observability/atof.mdx
{crates/core,crates/adaptive}/**/*

📄 CodeRabbit inference engine (.agents/skills/prepare-pr/SKILL.md)

Changes to crates/core or crates/adaptive must run the full language matrix

Files:

  • crates/core/tests/unit/context_tests.rs
  • crates/core/src/api/scope.rs
  • crates/core/src/api/llm.rs
  • crates/core/tests/unit/llm_api_tests.rs
  • crates/core/src/api/runtime/scope_stack.rs
crates/core/**/*.rs

📄 CodeRabbit inference engine (.agents/skills/test-go-binding/SKILL.md)

If the change touched crates/core or shared runtime semantics, also use validate-change for broader validation

Files:

  • crates/core/tests/unit/context_tests.rs
  • crates/core/src/api/scope.rs
  • crates/core/src/api/llm.rs
  • crates/core/tests/unit/llm_api_tests.rs
  • crates/core/src/api/runtime/scope_stack.rs
crates/{core,adaptive}/**/*

📄 CodeRabbit inference engine (.agents/skills/validate-change/SKILL.md)

If crates/core or crates/adaptive changed, run the full validation matrix across Rust, Python, Go, and Node.js.

Files:

  • crates/core/tests/unit/context_tests.rs
  • crates/core/src/api/scope.rs
  • crates/core/src/api/llm.rs
  • crates/core/tests/unit/llm_api_tests.rs
  • crates/core/src/api/runtime/scope_stack.rs
crates/{core,adaptive}/**/*.rs

⚙️ CodeRabbit configuration file

crates/{core,adaptive}/**/*.rs: Review the Rust runtime for async correctness, scope isolation, middleware ordering, and event lifecycle regressions.
Pay close attention to task-local/thread-local scope propagation, callback lifetimes, stream finalization, and root_uuid isolation.
Public API changes should preserve existing behavior unless tests and docs show the intended migration path.

Files:

  • crates/core/tests/unit/context_tests.rs
  • crates/core/src/api/scope.rs
  • crates/core/src/api/llm.rs
  • crates/core/tests/unit/llm_api_tests.rs
  • crates/core/src/api/runtime/scope_stack.rs
**/*.mdx

📄 CodeRabbit inference engine (.agents/skills/review-doc-style/SKILL.md)

MDX top-of-file SPDX comments must use {/* ... */} delimiters instead of HTML comment delimiters (Must-Fix)

In MDX files, top-of-file comments must use JSX comment delimiters ({/* to open and */} to close); do not use HTML comments for MDX SPDX headers

Files:

  • docs/nemo-relay-cli/basic-usage.mdx
  • docs/instrument-applications/instrument-llm-call.mdx
  • docs/nemo-relay-cli/claude-code.mdx
  • docs/nemo-relay-cli/codex.mdx
  • docs/about-nemo-relay/concepts/events.mdx
  • docs/configure-plugins/observability/atof.mdx
{docs,examples}/**/*

📄 CodeRabbit inference engine (.agents/skills/rename-surfaces/SKILL.md)

Update docs and examples.

Files:

  • docs/nemo-relay-cli/basic-usage.mdx
  • docs/instrument-applications/instrument-llm-call.mdx
  • docs/nemo-relay-cli/claude-code.mdx
  • docs/nemo-relay-cli/codex.mdx
  • docs/about-nemo-relay/concepts/events.mdx
  • docs/configure-plugins/observability/atof.mdx
docs/**/*

📄 CodeRabbit inference engine (.agents/skills/validate-change/SKILL.md)

If documentation examples or commands under docs/ change, run the targeted docs checks appropriate to the change.

Files:

  • docs/nemo-relay-cli/basic-usage.mdx
  • docs/instrument-applications/instrument-llm-call.mdx
  • docs/nemo-relay-cli/claude-code.mdx
  • docs/nemo-relay-cli/codex.mdx
  • docs/about-nemo-relay/concepts/events.mdx
  • docs/configure-plugins/observability/atof.mdx
{docs/**,README.md,CONTRIBUTING.md,RELEASING.md,SECURITY.md}

⚙️ CodeRabbit configuration file

{docs/**,README.md,CONTRIBUTING.md,RELEASING.md,SECURITY.md}: Review documentation for technical accuracy against the current API, command correctness, and consistency across language bindings.
Flag stale examples, missing SPDX headers where required, and instructions that no longer match CI or pre-commit behavior.

Files:

  • docs/nemo-relay-cli/basic-usage.mdx
  • docs/instrument-applications/instrument-llm-call.mdx
  • docs/nemo-relay-cli/claude-code.mdx
  • docs/nemo-relay-cli/codex.mdx
  • docs/about-nemo-relay/concepts/events.mdx
  • docs/configure-plugins/observability/atof.mdx
{crates/**/src/**/*.rs,python/**/*.py}

📄 CodeRabbit inference engine (.agents/skills/maintain-dynamic-plugins/SKILL.md)

Do not add tests under src; Rust tests belong in crate tests/ trees, and Python SDK tests belong under python/tests.

Files:

  • crates/cli/src/adapters/mod.rs
  • crates/core/src/api/scope.rs
  • crates/core/src/api/llm.rs
  • crates/core/src/api/runtime/scope_stack.rs
crates/core/src/{api/**/*.rs,api/runtime/**/*.rs,codec/**/*.rs,json.rs}

📄 CodeRabbit inference engine (.agents/skills/add-binding-feature/SKILL.md)

Implement the new or changed public runtime behavior first in the Rust core, especially under crates/core/src/api/ and related core modules such as crates/core/src/api/runtime/, crates/core/src/codec/, and crates/core/src/json.rs.

Files:

  • crates/core/src/api/scope.rs
  • crates/core/src/api/llm.rs
  • crates/core/src/api/runtime/scope_stack.rs
crates/core/src/api/{tool,llm}.rs

📄 CodeRabbit inference engine (.agents/skills/add-middleware/SKILL.md)

Wire the new middleware chain into the execute path in crates/core/src/api/tool.rs or crates/core/src/api/llm.rs at the appropriate pipeline stage

Files:

  • crates/core/src/api/llm.rs
🔇 Additional comments (24)
crates/cli/src/adapters/mod.rs (1)

898-905: 📐 Maintainability & Code Quality

Run the required Rust validation before handoff.

The PostCompact classification is correct. Because this is a Rust change, run just test-rust, cargo fmt --all, and cargo clippy --workspace --all-targets -- -D warnings.

As per coding guidelines, “Any Rust change must run just test-rust,” “cargo fmt --all,” and “cargo clippy --workspace --all-targets -- -D warnings.”

Source: Coding guidelines

crates/cli/tests/coverage/adapters_tests.rs (1)

929-934: LGTM!

docs/nemo-relay-cli/basic-usage.mdx (1)

309-310: LGTM!

docs/nemo-relay-cli/claude-code.mdx (1)

125-129: LGTM!

docs/nemo-relay-cli/codex.mdx (1)

182-188: LGTM!

crates/core/src/api/runtime/scope_stack.rs (2)

12-12: LGTM!

Also applies to: 28-32, 40-51, 57-62, 132-158, 244-251


160-174: 🎯 Functional Correctness

No reachable stale-parent path here. handle.parent_uuid is fixed when the LLM handle is created, and take_agent_freshness() runs immediately against the captured stack during start emission. A missing lookup would only occur if a caller passed an unrelated or stale ScopeHandle explicitly, so this is defensive fallback behavior rather than a current bug.

			> Likely an incorrect or invalid review comment.
crates/core/tests/unit/context_tests.rs (1)

98-136: LGTM!

docs/configure-plugins/observability/atof.mdx (1)

102-106: LGTM!

docs/instrument-applications/instrument-llm-call.mdx (1)

240-244: LGTM!

skills/nemo-relay-export-atif-trajectories/SKILL.md (1)

25-28: LGTM!

crates/core/src/api/llm.rs (6)

326-347: 🎯 Functional Correctness | ⚡ Quick win

Verify Developer-role instructions survive the user-found branch.

is_instruction only matches Message::System { .. }. In the user-found branch of retain_current_request_turn, items.retain(is_instruction) drops every prefix item that isn't a match — so if Message has a distinct Developer variant (OpenAI Responses supports developer alongside system), developer instructions preceding the current turn are silently discarded. This mirrors a still-open prior review comment ("Could we split the no-user fallback by history kind here?... contradict the new start-event contract to preserve system/developer instructions") that has no recorded resolution, unlike the sibling no-user-branch fix.

🔍 Verification script
#!/bin/bash
set -euo pipefail
rg -n "pub enum Message" -A 60 crates/types/src/codec/request.rs crates/core/src/codec/request.rs 2>/dev/null
echo '---'
rg -n "Developer" crates -g '*.rs'

If Message::Developer exists, update the predicate:

🐛 Proposed fix
     retain_current_request_turn(
         &mut annotated_request.messages,
         |message| matches!(message, Message::User { .. }),
-        |message| matches!(message, Message::System { .. }),
+        |message| matches!(message, Message::System { .. } | Message::Developer { .. }),
     )

391-407: 🩺 Stability & Availability | 🏗️ Heavy lift

Freshness reservation is atomic; emission ordering after lock release is not.

take_agent_freshness is consumed under a write lock, but the lock is released before project_llm_request_to_current_user_turn, event construction, sanitization, and dispatcher enqueue run. Two threads sharing a propagated scope stack can still have the call that reserved the baseline enqueue after a call that was told it's stale, so a subscriber can observe the bounded event before the baseline. This is the same gap raised previously ("only the reservation is atomic... should baseline selection be coupled to an ordered emission sequence") and marked "Addressing," but the code here still shows the same release-then-emit shape. The new concurrent_starts_consume_freshness_exactly_once_without_ordering test (llm_api_tests.rs) only checks exactly-once consumption, not dispatch order, so it doesn't close this gap.


32-32: LGTM!


301-324: No-user fallback now preserves instructions correctly.

retain_current_request_turn's no-user branch now retains index == last_index || is_instruction(item), so a userless [system, system] history keeps both items instead of collapsing to the last one — this addresses the previously-flagged "no-user branch drains instructions" bug.


416-416: LGTM!


544-546: LGTM!

docs/about-nemo-relay/concepts/events.mdx (1)

83-89: LGTM!

Also applies to: 104-104

skills/nemo-relay-export-openinference/SKILL.md (1)

32-34: LGTM!

skills/nemo-relay-setup-observability/SKILL.md (1)

41-43: LGTM!

crates/core/tests/unit/llm_api_tests.rs (4)

72-130: LGTM!


132-179: LGTM!


182-272: LGTM!


274-355: LGTM!

Comment thread crates/core/src/api/scope.rs Outdated
Comment thread crates/core/src/api/scope.rs Outdated
Comment thread crates/core/tests/unit/llm_api_tests.rs
@willkill07 willkill07 force-pushed the feat/relay-445-limit-llm-event-context branch from 9335871 to cce72f3 Compare July 10, 2026 20:19
Comment thread crates/core/src/api/runtime/scope_stack.rs
Comment thread docs/instrument-applications/instrument-llm-call.mdx Outdated

@mnajafian-nv mnajafian-nv left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work, I love the simplification... Conditional approval upon reviewing inline suggestions

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 4

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@crates/core/src/api/llm.rs`:
- Around line 330-341: In the annotation projection logic of
emit_llm_start_with_subscribers, stop propagating codec.encode failures with ?.
Treat re-encoding as best-effort: only replace request and annotated_request
when encoding succeeds, and on failure preserve the original request and
annotation while allowing the LLM call to continue, matching the graceful
handling used by the sibling decode path.

In `@crates/core/tests/unit/llm_api_tests.rs`:
- Around line 185-283: Add error-path coverage to managed and streaming call
tests for a stale agent whose codec.encode fails inside
project_llm_request_to_current_user_turn. Introduce a test codec or failing
encode implementation using the existing LlmCodec interface, invoke both
llm_call_execute and llm_stream_call_execute, and assert the intended behavior
explicitly—currently propagated call failure, or graceful fallback if the
implementation is changed—while confirming fresh-agent behavior remains
unaffected.

In `@docs/configure-plugins/observability/atof.mdx`:
- Around line 102-106: The ATOF documentation incorrectly implies annotation
history retention is codec-dependent. Update the paragraph around “Codec-backed
LLM request inputs and annotations” to state that annotations are projected to
the current user turn whenever the owning agent is not fresh, while a configured
request codec additionally preserves the emitted event input’s complete history;
clarify that provider execution remains unchanged.

In `@docs/instrument-applications/instrument-llm-call.mdx`:
- Around line 240-244: The LLM start documentation incorrectly makes annotation
freshness projection appear dependent on a request codec. Update the description
around emit_llm_start_with_subscribers to state that inputs require a request
codec for current-turn projection, while annotations are projected to the
current user turn unconditionally; preserve the distinction between event inputs
and the provider execution request.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Enterprise

Run ID: ad963f91-9e12-4e6f-abd5-7f3585b33abe

📥 Commits

Reviewing files that changed from the base of the PR and between 9335871 and cce72f3.

📒 Files selected for processing (16)
  • crates/cli/src/adapters/mod.rs
  • crates/cli/tests/coverage/adapters_tests.rs
  • crates/core/src/api/llm.rs
  • crates/core/src/api/runtime/scope_stack.rs
  • crates/core/src/api/scope.rs
  • crates/core/tests/unit/context_tests.rs
  • crates/core/tests/unit/llm_api_tests.rs
  • docs/about-nemo-relay/concepts/events.mdx
  • docs/configure-plugins/observability/atof.mdx
  • docs/instrument-applications/instrument-llm-call.mdx
  • docs/nemo-relay-cli/basic-usage.mdx
  • docs/nemo-relay-cli/claude-code.mdx
  • docs/nemo-relay-cli/codex.mdx
  • skills/nemo-relay-export-atif-trajectories/SKILL.md
  • skills/nemo-relay-export-openinference/SKILL.md
  • skills/nemo-relay-setup-observability/SKILL.md
📜 Review details
⏰ Context from checks skipped due to timeout. (3)
  • GitHub Check: CodeRabbit / Review
  • GitHub Check: Check / Run
  • GitHub Check: Preview docs
🧰 Additional context used
📓 Path-based instructions (28)
**/*.mdx

📄 CodeRabbit inference engine (.agents/skills/review-doc-style/SKILL.md)

MDX top-of-file SPDX comments must use {/* ... */} delimiters instead of HTML comment delimiters (Must-Fix)

In MDX files, top-of-file comments must use JSX comment delimiters ({/* to open and */} to close); do not use HTML comments for MDX SPDX headers

Files:

  • docs/nemo-relay-cli/basic-usage.mdx
  • docs/nemo-relay-cli/codex.mdx
  • docs/about-nemo-relay/concepts/events.mdx
  • docs/instrument-applications/instrument-llm-call.mdx
  • docs/nemo-relay-cli/claude-code.mdx
  • docs/configure-plugins/observability/atof.mdx
**/*.{md,mdx}

📄 CodeRabbit inference engine (AGENTS.md)

Update README.md, fern/, package READMEs, and binding-support notes when public behavior, package names, examples, or supported bindings change.

**/*.{md,mdx}: Prefer the documented public API, not internal shortcuts
Keep package names, repo references, and build commands current
Keep release-process and release-notes guidance in repo-maintainer docs such as RELEASING.md, not as user-facing docs pages or CHANGELOG.md
Keep stable user-facing wrappers at scripts/ root in docs and examples; only point at namespaced helper paths when documenting internal maintenance work
When detailed dynamic plugin guides exist, keep Rust native plugin examples, Python worker plugin examples, and grpc-v1 protocol details on separate pages

If links in documentation change, run just docs-linkcheck.

Files:

  • docs/nemo-relay-cli/basic-usage.mdx
  • docs/nemo-relay-cli/codex.mdx
  • skills/nemo-relay-setup-observability/SKILL.md
  • skills/nemo-relay-export-atif-trajectories/SKILL.md
  • docs/about-nemo-relay/concepts/events.mdx
  • skills/nemo-relay-export-openinference/SKILL.md
  • docs/instrument-applications/instrument-llm-call.mdx
  • docs/nemo-relay-cli/claude-code.mdx
  • docs/configure-plugins/observability/atof.mdx
**/*.{md,markdown,mdx}

📄 CodeRabbit inference engine (CONTRIBUTING.md)

Add the SPDX license header to all Markdown/MDX documentation files using the HTML comment block form.

Files:

  • docs/nemo-relay-cli/basic-usage.mdx
  • docs/nemo-relay-cli/codex.mdx
  • skills/nemo-relay-setup-observability/SKILL.md
  • skills/nemo-relay-export-atif-trajectories/SKILL.md
  • docs/about-nemo-relay/concepts/events.mdx
  • skills/nemo-relay-export-openinference/SKILL.md
  • docs/instrument-applications/instrument-llm-call.mdx
  • docs/nemo-relay-cli/claude-code.mdx
  • docs/configure-plugins/observability/atof.mdx
{docs,examples}/**/*

📄 CodeRabbit inference engine (.agents/skills/rename-surfaces/SKILL.md)

Update docs and examples.

Files:

  • docs/nemo-relay-cli/basic-usage.mdx
  • docs/nemo-relay-cli/codex.mdx
  • docs/about-nemo-relay/concepts/events.mdx
  • docs/instrument-applications/instrument-llm-call.mdx
  • docs/nemo-relay-cli/claude-code.mdx
  • docs/configure-plugins/observability/atof.mdx
**/*

📄 CodeRabbit inference engine (.agents/skills/validate-change/SKILL.md)

**/*: Format changed files with the language-native formatter before the final lint/test pass.
If dynamic plugin behavior changed, use maintain-dynamic-plugins and include the native SDK, worker protocol, Python SDK, docs, packaging, and Codecov surfaces in the validation plan.
If code changes alter APIs, bindings, commands, paths, packaging behavior, observability/adaptive semantics, or documented best practices, update any dependent maintainer or consumer skills in the same branch.
During iteration, prefer uv run pre-commit run --files <changed files...>.
Before review or handoff, run uv run pre-commit run --all-files.

Files:

  • docs/nemo-relay-cli/basic-usage.mdx
  • docs/nemo-relay-cli/codex.mdx
  • skills/nemo-relay-setup-observability/SKILL.md
  • skills/nemo-relay-export-atif-trajectories/SKILL.md
  • crates/cli/tests/coverage/adapters_tests.rs
  • crates/cli/src/adapters/mod.rs
  • docs/about-nemo-relay/concepts/events.mdx
  • skills/nemo-relay-export-openinference/SKILL.md
  • docs/instrument-applications/instrument-llm-call.mdx
  • docs/nemo-relay-cli/claude-code.mdx
  • crates/core/tests/unit/context_tests.rs
  • docs/configure-plugins/observability/atof.mdx
  • crates/core/src/api/scope.rs
  • crates/core/src/api/llm.rs
  • crates/core/src/api/runtime/scope_stack.rs
  • crates/core/tests/unit/llm_api_tests.rs
docs/**/*

📄 CodeRabbit inference engine (.agents/skills/validate-change/SKILL.md)

If documentation examples or commands under docs/ change, run the targeted docs checks appropriate to the change.

Files:

  • docs/nemo-relay-cli/basic-usage.mdx
  • docs/nemo-relay-cli/codex.mdx
  • docs/about-nemo-relay/concepts/events.mdx
  • docs/instrument-applications/instrument-llm-call.mdx
  • docs/nemo-relay-cli/claude-code.mdx
  • docs/configure-plugins/observability/atof.mdx
**

⚙️ CodeRabbit configuration file

**:

AGENTS.md

This file provides guidance to agents, including Claude Code and OpenAI Codex, when working in this repository.

Project Overview

NeMo Relay is a multi-language agent runtime framework for execution scopes, lifecycle events, middleware, plugins, and observability around tool and LLM calls. The core runtime is Rust. Primary supported bindings are Rust, Python, and Node.js. Go and the raw C FFI are experimental and source-first.

The shared runtime model is:

  1. Scope stacks decide where work belongs and which scope-local behavior is visible.
  2. Middleware registries decide what guardrails and intercepts run around managed calls.
  3. Plugins install reusable runtime behavior from configuration.
  4. Events record runtime behavior in ATOF form.
  5. Subscribers and exporters consume events in-process or export them to ATIF, OpenTelemetry, OpenInference, or other backends.

Repository Structure

The repository layout separates the Rust runtime, language bindings,
documentation, integrations, and agent-facing skills.

crates/
  core/       # Rust core runtime crate, published as nemo-relay
  adaptive/   # Adaptive runtime primitives and plugin components
  python/     # PyO3 native extension for the Python package
  ffi/        # Raw C ABI layer used by downstream bindings such as Go
  node/       # NAPI Node.js binding and JavaScript/TypeScript entry points
python/
  nemo_relay/  # Python wrapper package: scopes, tools, LLM, middleware, typed helpers, plugins, adaptive helpers
  tests/      # Python tests
go/
  nemo_relay/  # Experimental Go CGo binding and tests
fern/         # Fern documentation site
scripts/      # Stable wrappers and helper scripts; build/test/docs entry points live in justfile
skills/       # Published Codex/agent skills for NeMo Relay usage patterns

Prerequisites

Insta...

Files:

  • docs/nemo-relay-cli/basic-usage.mdx
  • docs/nemo-relay-cli/codex.mdx
  • skills/nemo-relay-setup-observability/SKILL.md
  • skills/nemo-relay-export-atif-trajectories/SKILL.md
  • crates/cli/tests/coverage/adapters_tests.rs
  • crates/cli/src/adapters/mod.rs
  • docs/about-nemo-relay/concepts/events.mdx
  • skills/nemo-relay-export-openinference/SKILL.md
  • docs/instrument-applications/instrument-llm-call.mdx
  • docs/nemo-relay-cli/claude-code.mdx
  • crates/core/tests/unit/context_tests.rs
  • docs/configure-plugins/observability/atof.mdx
  • crates/core/src/api/scope.rs
  • crates/core/src/api/llm.rs
  • crates/core/src/api/runtime/scope_stack.rs
  • crates/core/tests/unit/llm_api_tests.rs
{docs/**,README.md,CONTRIBUTING.md,RELEASING.md,SECURITY.md}

⚙️ CodeRabbit configuration file

{docs/**,README.md,CONTRIBUTING.md,RELEASING.md,SECURITY.md}: Review documentation for technical accuracy against the current API, command correctness, and consistency across language bindings.
Flag stale examples, missing SPDX headers where required, and instructions that no longer match CI or pre-commit behavior.

Files:

  • docs/nemo-relay-cli/basic-usage.mdx
  • docs/nemo-relay-cli/codex.mdx
  • docs/about-nemo-relay/concepts/events.mdx
  • docs/instrument-applications/instrument-llm-call.mdx
  • docs/nemo-relay-cli/claude-code.mdx
  • docs/configure-plugins/observability/atof.mdx
**/*.{md,rst,html,txt}

📄 CodeRabbit inference engine (.agents/skills/review-doc-style/assets/nvidia-style-brand-terminology.md)

**/*.{md,rst,html,txt}: Always spell NVIDIA in all caps. Do not use Nvidia, nvidia, nVidia, nVIDIA, or NV.
Use an NVIDIA before a noun because the name starts with an 'en' sound.
Do not add a registered trademark symbol after NVIDIA when referring to the company.
Use trademark symbols with product names only when the document type or legal guidance requires them.
Verify official capitalization, spacing, and hyphenation for product names.
Precede NVIDIA product names with NVIDIA on first mention when it is natural and accurate.
Do not rewrite product names for grammar or title-case rules.
Preserve third-party product names according to the owner's spelling.
Include the company name and full model qualifier on first use when it helps identify the model.
Preserve the official capitalization and punctuation of model names.
Use shorter family names only after the full name is established.
Spell out a term on first use and put the acronym in parentheses unless the acronym is widely understood by the intended audience.
Use the acronym on later mentions after it has been defined.
For long documents, reintroduce the full term if readers might lose context.
Form plurals of acronyms with s, not an apostrophe, such as GPUs.
In headings, common acronyms can remain abbreviated. Spell out the term in the first or second sentence of the body.
Common terms such as CPU, GPU, PC, API, and UI usually do not need to be spelled out for developer audiences.

Files:

  • skills/nemo-relay-setup-observability/SKILL.md
  • skills/nemo-relay-export-atif-trajectories/SKILL.md
  • skills/nemo-relay-export-openinference/SKILL.md
**/*.{md,rst,html}

📄 CodeRabbit inference engine (.agents/skills/review-doc-style/assets/nvidia-style-brand-terminology.md)

Link the first mention of a product name when the destination helps the reader.

Files:

  • skills/nemo-relay-setup-observability/SKILL.md
  • skills/nemo-relay-export-atif-trajectories/SKILL.md
  • skills/nemo-relay-export-openinference/SKILL.md
**/*.{md,rst,txt}

📄 CodeRabbit inference engine (.agents/skills/review-doc-style/assets/nvidia-style-guide.md)

Spell NVIDIA in all caps. Do not use Nvidia, nvidia, or NV.

Files:

  • skills/nemo-relay-setup-observability/SKILL.md
  • skills/nemo-relay-export-atif-trajectories/SKILL.md
  • skills/nemo-relay-export-openinference/SKILL.md
**/*.{md,rst}

📄 CodeRabbit inference engine (.agents/skills/review-doc-style/assets/nvidia-style-guide.md)

**/*.{md,rst}: Format commands, code elements, expressions, package names, file names, and paths as inline code.
Use descriptive link text. Avoid raw URLs and weak anchors such as "here" or "read more."
Use title case consistently for technical documentation headings.
Introduce code blocks, lists, tables, and images with complete sentences.
Write procedures as imperative steps. Keep steps parallel and split long procedures into smaller tasks.
Prefer active voice, present tense, short sentences, contractions, and plain English.
Use can for possibility and reserve may for permission.
Use after for temporal relationships instead of once.
Prefer refer to over see when the wording points readers to another resource.
Avoid culture-specific idioms, unnecessary Latinisms, jokes, and marketing exaggeration in technical docs.
Spell out months in body text, avoid ordinal dates, and use clear time zones.
Spell out whole numbers from zero through nine unless they are technical values, parameters, versions, or UI values.
Use numerals for 10 or greater and include commas in thousands.
Do not add trademark symbols to learning-oriented docs unless the source, platform, or legal guidance explicitly requires them.

Files:

  • skills/nemo-relay-setup-observability/SKILL.md
  • skills/nemo-relay-export-atif-trajectories/SKILL.md
  • skills/nemo-relay-export-openinference/SKILL.md
**/*.md

📄 CodeRabbit inference engine (.agents/skills/review-doc-style/assets/nvidia-style-technical-docs.md)

**/*.md: Use title case consistently in technical documentation headings
Avoid quotation marks, ampersands, and exclamation marks in headings
Keep product, event, research, and whitepaper names in their official title case
Use title case for table headers
Do not force social-media sentence case into technical docs
Format code elements, commands, parameters, package names, and expressions in monospace
Format directories, file names, and paths in monospace using backticks
Use angle brackets inside monospace for variables inside paths, such as /home/<username>/.login
Format error messages and strings in quotation marks, keeping literal code strings in code formatting when clearer
Format UI buttons, menus, fields, and labels in bold
Use angle brackets between UI labels for menu paths, such as File > Save As
Use italics for new terms on first use, sparingly and only when introducing the term
Use italics for publication titles
Format keyboard shortcuts in plain text, such as Press Ctrl+Alt+Delete
Use owner/repo link text for GitHub repositories, preferring [NVIDIA/NeMo](link) over prose references like 'the GitHub repo'
Introduce every code block with a complete sentence
Do not make a code block complete the grammar of the previous sentence
Do not continue a sentence after a code block
Use syntax highlighting when the format supports it for code blocks
Avoid the word 'snippet' unless the surrounding docs already use it as a term of art
Keep inline method, function, and class references consistent with nearby docs, omitting empty parentheses for prose readability when no call is shown
Use descriptive anchor text that matches the destination title when possible for links
Avoid raw URLs in running text
Avoid generic anchor text such as 'here,' 'this page,' and 'read more'
Include acronyms in link text when a linked term includes an acronym
Do not link long sentences or multiple sentences
Avoid links that pull readers away from a procedure unless the link is a p...

Files:

  • skills/nemo-relay-setup-observability/SKILL.md
  • skills/nemo-relay-export-atif-trajectories/SKILL.md
  • skills/nemo-relay-export-openinference/SKILL.md
**/SKILL.md

📄 CodeRabbit inference engine (AGENTS.md)

SKILL.md files are skill entrypoints and must start with YAML frontmatter containing at least name and description.

Files:

  • skills/nemo-relay-setup-observability/SKILL.md
  • skills/nemo-relay-export-atif-trajectories/SKILL.md
  • skills/nemo-relay-export-openinference/SKILL.md

⚙️ CodeRabbit configuration file

**/SKILL.md: Do not flag SKILL.md files for missing SPDX headers. Skill entrypoints intentionally start with YAML frontmatter instead.
Verify that every SKILL.md keeps valid YAML frontmatter with at least name and description fields before the Markdown body.

Files:

  • skills/nemo-relay-setup-observability/SKILL.md
  • skills/nemo-relay-export-atif-trajectories/SKILL.md
  • skills/nemo-relay-export-openinference/SKILL.md
**/*.rs

📄 CodeRabbit inference engine (.agents/skills/prepare-pr/SKILL.md)

**/*.rs: Any Rust change must run just test-rust
Any Rust change must run cargo fmt --all
Any Rust change must run cargo clippy --workspace --all-targets -- -D warnings

**/*.rs: Run cargo fmt --all for all FFI work since it is Rust work
Run just test-rust to validate FFI changes
Run cargo clippy --workspace --all-targets -- -D warnings to enforce strict linting on FFI work

When Rust files changed as part of Go work, also run cargo fmt --all, just test-rust, and cargo clippy --workspace --all-targets -- -D warnings

**/*.rs: Run cargo fmt --all when Rust files are changed as part of Node work
Run cargo clippy --workspace --all-targets -- -D warnings when Rust files are changed as part of Node work
Run just test-rust when Rust files are changed as part of Node work

When changing the core Rust runtime or Rust-facing API surface, format Rust code with cargo fmt (rustfmt defaults), keep cargo clippy -- -D warnings clean, and satisfy cargo deny check per deny.toml.

**/*.rs: If any Rust code changed, always run just test-rust.
If any Rust code changed, also run cargo fmt --all.
If any Rust code changed, also run cargo clippy --workspace --all-targets -- -D warnings.
For Rust changes headed for review, run cargo fmt --all and cargo clippy --workspace --all-targets -- -D warnings even if relying on pre-commit.

Files:

  • crates/cli/tests/coverage/adapters_tests.rs
  • crates/cli/src/adapters/mod.rs
  • crates/core/tests/unit/context_tests.rs
  • crates/core/src/api/scope.rs
  • crates/core/src/api/llm.rs
  • crates/core/src/api/runtime/scope_stack.rs
  • crates/core/tests/unit/llm_api_tests.rs
**/*.{rs,py}

📄 CodeRabbit inference engine (AGENTS.md)

Follow binding naming conventions in Rust and Python: use snake_case.

Files:

  • crates/cli/tests/coverage/adapters_tests.rs
  • crates/cli/src/adapters/mod.rs
  • crates/core/tests/unit/context_tests.rs
  • crates/core/src/api/scope.rs
  • crates/core/src/api/llm.rs
  • crates/core/src/api/runtime/scope_stack.rs
  • crates/core/tests/unit/llm_api_tests.rs
**/*.{rs,py,js,mjs,cjs,ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

**/*.{rs,py,js,mjs,cjs,ts,tsx}: Use Json = serde_json::Value in Rust-facing runtime APIs where the existing code expects JSON payloads.
Use Result<T> with FlowError in core runtime paths, and keep errors explicit and binding-appropriate at the wrapper layer.
Keep async behavior on the existing tokio-based model; bindings should preserve callback and future lifetimes rather than blocking or hiding async work unexpectedly.

Files:

  • crates/cli/tests/coverage/adapters_tests.rs
  • crates/cli/src/adapters/mod.rs
  • crates/core/tests/unit/context_tests.rs
  • crates/core/src/api/scope.rs
  • crates/core/src/api/llm.rs
  • crates/core/src/api/runtime/scope_stack.rs
  • crates/core/tests/unit/llm_api_tests.rs
**/*.{rs,py,go,js,ts,c,h}

📄 CodeRabbit inference engine (CONTRIBUTING.md)

Use language-appropriate naming conventions: Rust snake_case, C FFI exports prefixed nemo_relay_, Go PascalCase, Node.js camelCase, and Python snake_case.

Files:

  • crates/cli/tests/coverage/adapters_tests.rs
  • crates/cli/src/adapters/mod.rs
  • crates/core/tests/unit/context_tests.rs
  • crates/core/src/api/scope.rs
  • crates/core/src/api/llm.rs
  • crates/core/src/api/runtime/scope_stack.rs
  • crates/core/tests/unit/llm_api_tests.rs
**/*.{rs,go,js,ts}

📄 CodeRabbit inference engine (CONTRIBUTING.md)

Add the SPDX license header to all Rust, Go, JavaScript, and TypeScript source files using the corresponding // comment form.

Files:

  • crates/cli/tests/coverage/adapters_tests.rs
  • crates/cli/src/adapters/mod.rs
  • crates/core/tests/unit/context_tests.rs
  • crates/core/src/api/scope.rs
  • crates/core/src/api/llm.rs
  • crates/core/src/api/runtime/scope_stack.rs
  • crates/core/tests/unit/llm_api_tests.rs
**/*.{rs,py,go,js,ts}

📄 CodeRabbit inference engine (.agents/skills/validate-change/SKILL.md)

If a language surface changed, always run that language's test target even when Rust core did not change.

Files:

  • crates/cli/tests/coverage/adapters_tests.rs
  • crates/cli/src/adapters/mod.rs
  • crates/core/tests/unit/context_tests.rs
  • crates/core/src/api/scope.rs
  • crates/core/src/api/llm.rs
  • crates/core/src/api/runtime/scope_stack.rs
  • crates/core/tests/unit/llm_api_tests.rs
{crates/**/tests/**,python/tests/**,go/nemo_relay/**/*_test.go}

⚙️ CodeRabbit configuration file

{crates/**/tests/**,python/tests/**,go/nemo_relay/**/*_test.go}: Tests should cover the behavior promised by the changed API surface, including error paths and cross-request isolation where relevant.
Prefer assertions on lifecycle events, scope stacks, middleware ordering, and binding parity over shallow smoke tests.

Files:

  • crates/cli/tests/coverage/adapters_tests.rs
  • crates/core/tests/unit/context_tests.rs
  • crates/core/tests/unit/llm_api_tests.rs
{crates/**/src/**/*.rs,python/**/*.py}

📄 CodeRabbit inference engine (.agents/skills/maintain-dynamic-plugins/SKILL.md)

Do not add tests under src; Rust tests belong in crate tests/ trees, and Python SDK tests belong under python/tests.

Files:

  • crates/cli/src/adapters/mod.rs
  • crates/core/src/api/scope.rs
  • crates/core/src/api/llm.rs
  • crates/core/src/api/runtime/scope_stack.rs
{crates/core,crates/adaptive}/**/*

📄 CodeRabbit inference engine (.agents/skills/prepare-pr/SKILL.md)

Changes to crates/core or crates/adaptive must run the full language matrix

Files:

  • crates/core/tests/unit/context_tests.rs
  • crates/core/src/api/scope.rs
  • crates/core/src/api/llm.rs
  • crates/core/src/api/runtime/scope_stack.rs
  • crates/core/tests/unit/llm_api_tests.rs
crates/core/**/*.rs

📄 CodeRabbit inference engine (.agents/skills/test-go-binding/SKILL.md)

If the change touched crates/core or shared runtime semantics, also use validate-change for broader validation

Files:

  • crates/core/tests/unit/context_tests.rs
  • crates/core/src/api/scope.rs
  • crates/core/src/api/llm.rs
  • crates/core/src/api/runtime/scope_stack.rs
  • crates/core/tests/unit/llm_api_tests.rs
crates/{core,adaptive}/**/*

📄 CodeRabbit inference engine (.agents/skills/validate-change/SKILL.md)

If crates/core or crates/adaptive changed, run the full validation matrix across Rust, Python, Go, and Node.js.

Files:

  • crates/core/tests/unit/context_tests.rs
  • crates/core/src/api/scope.rs
  • crates/core/src/api/llm.rs
  • crates/core/src/api/runtime/scope_stack.rs
  • crates/core/tests/unit/llm_api_tests.rs
crates/{core,adaptive}/**/*.rs

⚙️ CodeRabbit configuration file

crates/{core,adaptive}/**/*.rs: Review the Rust runtime for async correctness, scope isolation, middleware ordering, and event lifecycle regressions.
Pay close attention to task-local/thread-local scope propagation, callback lifetimes, stream finalization, and root_uuid isolation.
Public API changes should preserve existing behavior unless tests and docs show the intended migration path.

Files:

  • crates/core/tests/unit/context_tests.rs
  • crates/core/src/api/scope.rs
  • crates/core/src/api/llm.rs
  • crates/core/src/api/runtime/scope_stack.rs
  • crates/core/tests/unit/llm_api_tests.rs
crates/core/src/{api/**/*.rs,api/runtime/**/*.rs,codec/**/*.rs,json.rs}

📄 CodeRabbit inference engine (.agents/skills/add-binding-feature/SKILL.md)

Implement the new or changed public runtime behavior first in the Rust core, especially under crates/core/src/api/ and related core modules such as crates/core/src/api/runtime/, crates/core/src/codec/, and crates/core/src/json.rs.

Files:

  • crates/core/src/api/scope.rs
  • crates/core/src/api/llm.rs
  • crates/core/src/api/runtime/scope_stack.rs
crates/core/src/api/{tool,llm}.rs

📄 CodeRabbit inference engine (.agents/skills/add-middleware/SKILL.md)

Wire the new middleware chain into the execute path in crates/core/src/api/tool.rs or crates/core/src/api/llm.rs at the appropriate pipeline stage

Files:

  • crates/core/src/api/llm.rs
🔇 Additional comments (20)
crates/cli/src/adapters/mod.rs (1)

898-898: 📐 Maintainability & Code Quality

Confirm the required Rust validation before merge.

Please verify just test-rust, cargo fmt --all, and cargo clippy --workspace --all-targets -- -D warnings pass for this Rust change.

As per coding guidelines, “Any Rust change must run just test-rust,” cargo fmt --all, and cargo clippy --workspace --all-targets -- -D warnings.

Source: Coding guidelines

crates/cli/tests/coverage/adapters_tests.rs (1)

933-933: LGTM!

docs/nemo-relay-cli/basic-usage.mdx (1)

309-310: LGTM!

docs/nemo-relay-cli/claude-code.mdx (1)

125-129: LGTM!

docs/nemo-relay-cli/codex.mdx (1)

184-185: LGTM!

crates/core/src/api/scope.rs (2)

331-338: 🚀 Performance & Scalability | ⚡ Quick win

Write lock still taken unconditionally for non-compaction mark events.

scope_stack.write() is acquired for every call to event(), but mark_agent_fresh only runs when params.name == "compaction". Non-compaction mark events now block concurrent readers unnecessarily on this hot path. This was flagged in a prior review round and remains unresolved.


336-336: 📐 Maintainability & Code Quality | 💤 Low value

"compaction" literal still duplicated across files.

Same string is matched here, in crates/cli/src/adapters/mod.rs normalization, and in tests. A shared constant would prevent drift. Raised previously and still unresolved.

crates/core/src/api/runtime/scope_stack.rs (2)

12-12: LGTM!

Also applies to: 28-32, 40-51, 57-62, 132-158, 249-249


160-174: 🎯 Functional Correctness

Shared fallback is intentional. parent_uuid is taken from the active scope stack and stored on the handle, so owning_agent_uuid does not encounter a stale parent in the current flow.

			> Likely an incorrect or invalid review comment.
crates/core/tests/unit/context_tests.rs (1)

98-136: LGTM!

skills/nemo-relay-export-atif-trajectories/SKILL.md (1)

26-29: LGTM!

crates/core/src/api/llm.rs (4)

326-342: 🚀 Performance & Scalability

Unconditional deep clone before checking if projection is a no-op.

Same code as previously flagged: .cloned() always deep-clones the full AnnotatedLlmRequest, and the clone is discarded when limit_annotated_request_history_to_current_user_turn reports no change (e.g. instructions-only history). Arc::make_mut avoids the clone unless the Arc is actually shared.


406-417: 🩺 Stability & Availability

Freshness reservation is atomic; emission ordering is not.

Same unresolved concern as the earlier review thread: the write lock covers only take_agent_freshness, and is released before projection, event construction, sanitization, and dispatcher enqueue happen. Two threads sharing a scope stack can reserve freshness in one order but dispatch start events in the opposite order, so a consumer cannot rely on "first dispatched start = baseline."


32-32: LGTM!

Also applies to: 395-397, 426-426, 554-557


301-324: No-user instruction-retention fix looks correct.

Instructions before the current turn are now preserved via the is_instruction predicate in both branches (previously only the last item survived when no user message existed). Verified against request_projection_handles_history_edge_cases in llm_api_tests.rs (instructions-only and no-user cases both retain expected items).

crates/core/tests/unit/llm_api_tests.rs (2)

368-420: 🩺 Stability & Availability

Confirms exactly-once freshness consumption but doesn't verify dispatch order.

Same gap as the earlier review thread: this proves reservation is mutually exclusive ([2, 4] regardless of thread interleaving) but does not assert that event dispatch order matches reservation order — the residual concern flagged on emit_llm_start_with_subscribers.


8-29: LGTM!

Freshness/compaction idempotency, projection edge cases, and nested-agent freshness isolation are all well covered with lifecycle-event-level assertions rather than shallow smoke checks.

Also applies to: 53-71, 72-130, 132-183, 285-366

docs/about-nemo-relay/concepts/events.mdx (1)

83-91: LGTM!

Retention semantics (fresh-session full history, post-turn system+latest-user+trailing window, independent nested-agent freshness, codec-projected provider input, unchanged provider execution) match the implementation in crates/core/src/api/llm.rs and are consistent with the parallel wording in both updated SKILL.md files.

Also applies to: 106-106

skills/nemo-relay-export-openinference/SKILL.md (1)

32-35: LGTM!

Consistent with events.mdx and the llm.rs implementation.

skills/nemo-relay-setup-observability/SKILL.md (1)

41-44: LGTM!

Consistent with events.mdx and the OpenInference skill wording.

Comment thread crates/core/src/api/llm.rs Outdated
Comment thread crates/core/tests/unit/llm_api_tests.rs
Comment thread docs/configure-plugins/observability/atof.mdx Outdated
Comment thread docs/instrument-applications/instrument-llm-call.mdx Outdated
@willkill07 willkill07 force-pushed the feat/relay-445-limit-llm-event-context branch from cce72f3 to 5879962 Compare July 10, 2026 20:46

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 4

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@crates/core/src/api/llm.rs`:
- Around line 342-369: In project_llm_request_to_current_user_turn, do not
silently discard codec encoding failures: bind the error in the Err branch and
log a diagnostic via eprintln! before restoring original_annotation, matching
the existing logging approach in emit_optimization_marks_with while preserving
the graceful fallback behavior.

In `@docs/configure-plugins/observability/atof.mdx`:
- Around line 102-107: The ATOF documentation inaccurately describes stale LLM
request annotation history. Update the relevant wording near the ATOF event
description to state that stale annotations retain system instructions, the
latest user message, and all subsequent assistant/tool messages, matching the
terminology and behavior documented in the events concepts documentation.

In `@skills/nemo-relay-export-openinference/SKILL.md`:
- Around line 32-35: The stale-annotation documentation is incomplete: update
the relevant history-projection description in the skill documentation to state
that Relay retains system instructions, the latest user message, and all
subsequent assistant/tool messages, while preserving the fresh-session and
compaction behavior and provider-shaped input details.

In `@skills/nemo-relay-setup-observability/SKILL.md`:
- Around line 41-44: The stale-history description incorrectly says non-fresh
annotations retain only the current user turn. Update the relevant text in the
skill documentation to state that they retain system instructions, the latest
user message, and subsequent assistant/tool messages, matching the projection
semantics in events.mdx; keep the codec-backed event input wording consistent
and verify the documentation against the current API.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Enterprise

Run ID: 636ac15a-3043-4d2a-af4f-aa28ce65a5d9

📥 Commits

Reviewing files that changed from the base of the PR and between cce72f3 and 5879962.

📒 Files selected for processing (16)
  • crates/cli/src/adapters/mod.rs
  • crates/cli/tests/coverage/adapters_tests.rs
  • crates/core/src/api/llm.rs
  • crates/core/src/api/runtime/scope_stack.rs
  • crates/core/src/api/scope.rs
  • crates/core/tests/unit/context_tests.rs
  • crates/core/tests/unit/llm_api_tests.rs
  • docs/about-nemo-relay/concepts/events.mdx
  • docs/configure-plugins/observability/atof.mdx
  • docs/instrument-applications/instrument-llm-call.mdx
  • docs/nemo-relay-cli/basic-usage.mdx
  • docs/nemo-relay-cli/claude-code.mdx
  • docs/nemo-relay-cli/codex.mdx
  • skills/nemo-relay-export-atif-trajectories/SKILL.md
  • skills/nemo-relay-export-openinference/SKILL.md
  • skills/nemo-relay-setup-observability/SKILL.md
📜 Review details
🧰 Additional context used
📓 Path-based instructions (28)
**/*.{md,rst,html,txt}

📄 CodeRabbit inference engine (.agents/skills/review-doc-style/assets/nvidia-style-brand-terminology.md)

**/*.{md,rst,html,txt}: Always spell NVIDIA in all caps. Do not use Nvidia, nvidia, nVidia, nVIDIA, or NV.
Use an NVIDIA before a noun because the name starts with an 'en' sound.
Do not add a registered trademark symbol after NVIDIA when referring to the company.
Use trademark symbols with product names only when the document type or legal guidance requires them.
Verify official capitalization, spacing, and hyphenation for product names.
Precede NVIDIA product names with NVIDIA on first mention when it is natural and accurate.
Do not rewrite product names for grammar or title-case rules.
Preserve third-party product names according to the owner's spelling.
Include the company name and full model qualifier on first use when it helps identify the model.
Preserve the official capitalization and punctuation of model names.
Use shorter family names only after the full name is established.
Spell out a term on first use and put the acronym in parentheses unless the acronym is widely understood by the intended audience.
Use the acronym on later mentions after it has been defined.
For long documents, reintroduce the full term if readers might lose context.
Form plurals of acronyms with s, not an apostrophe, such as GPUs.
In headings, common acronyms can remain abbreviated. Spell out the term in the first or second sentence of the body.
Common terms such as CPU, GPU, PC, API, and UI usually do not need to be spelled out for developer audiences.

Files:

  • skills/nemo-relay-setup-observability/SKILL.md
  • skills/nemo-relay-export-openinference/SKILL.md
  • skills/nemo-relay-export-atif-trajectories/SKILL.md
**/*.{md,rst,html}

📄 CodeRabbit inference engine (.agents/skills/review-doc-style/assets/nvidia-style-brand-terminology.md)

Link the first mention of a product name when the destination helps the reader.

Files:

  • skills/nemo-relay-setup-observability/SKILL.md
  • skills/nemo-relay-export-openinference/SKILL.md
  • skills/nemo-relay-export-atif-trajectories/SKILL.md
**/*.{md,rst,txt}

📄 CodeRabbit inference engine (.agents/skills/review-doc-style/assets/nvidia-style-guide.md)

Spell NVIDIA in all caps. Do not use Nvidia, nvidia, or NV.

Files:

  • skills/nemo-relay-setup-observability/SKILL.md
  • skills/nemo-relay-export-openinference/SKILL.md
  • skills/nemo-relay-export-atif-trajectories/SKILL.md
**/*.{md,rst}

📄 CodeRabbit inference engine (.agents/skills/review-doc-style/assets/nvidia-style-guide.md)

**/*.{md,rst}: Format commands, code elements, expressions, package names, file names, and paths as inline code.
Use descriptive link text. Avoid raw URLs and weak anchors such as "here" or "read more."
Use title case consistently for technical documentation headings.
Introduce code blocks, lists, tables, and images with complete sentences.
Write procedures as imperative steps. Keep steps parallel and split long procedures into smaller tasks.
Prefer active voice, present tense, short sentences, contractions, and plain English.
Use can for possibility and reserve may for permission.
Use after for temporal relationships instead of once.
Prefer refer to over see when the wording points readers to another resource.
Avoid culture-specific idioms, unnecessary Latinisms, jokes, and marketing exaggeration in technical docs.
Spell out months in body text, avoid ordinal dates, and use clear time zones.
Spell out whole numbers from zero through nine unless they are technical values, parameters, versions, or UI values.
Use numerals for 10 or greater and include commas in thousands.
Do not add trademark symbols to learning-oriented docs unless the source, platform, or legal guidance explicitly requires them.

Files:

  • skills/nemo-relay-setup-observability/SKILL.md
  • skills/nemo-relay-export-openinference/SKILL.md
  • skills/nemo-relay-export-atif-trajectories/SKILL.md
**/*.md

📄 CodeRabbit inference engine (.agents/skills/review-doc-style/assets/nvidia-style-technical-docs.md)

**/*.md: Use title case consistently in technical documentation headings
Avoid quotation marks, ampersands, and exclamation marks in headings
Keep product, event, research, and whitepaper names in their official title case
Use title case for table headers
Do not force social-media sentence case into technical docs
Format code elements, commands, parameters, package names, and expressions in monospace
Format directories, file names, and paths in monospace using backticks
Use angle brackets inside monospace for variables inside paths, such as /home/<username>/.login
Format error messages and strings in quotation marks, keeping literal code strings in code formatting when clearer
Format UI buttons, menus, fields, and labels in bold
Use angle brackets between UI labels for menu paths, such as File > Save As
Use italics for new terms on first use, sparingly and only when introducing the term
Use italics for publication titles
Format keyboard shortcuts in plain text, such as Press Ctrl+Alt+Delete
Use owner/repo link text for GitHub repositories, preferring [NVIDIA/NeMo](link) over prose references like 'the GitHub repo'
Introduce every code block with a complete sentence
Do not make a code block complete the grammar of the previous sentence
Do not continue a sentence after a code block
Use syntax highlighting when the format supports it for code blocks
Avoid the word 'snippet' unless the surrounding docs already use it as a term of art
Keep inline method, function, and class references consistent with nearby docs, omitting empty parentheses for prose readability when no call is shown
Use descriptive anchor text that matches the destination title when possible for links
Avoid raw URLs in running text
Avoid generic anchor text such as 'here,' 'this page,' and 'read more'
Include acronyms in link text when a linked term includes an acronym
Do not link long sentences or multiple sentences
Avoid links that pull readers away from a procedure unless the link is a p...

Files:

  • skills/nemo-relay-setup-observability/SKILL.md
  • skills/nemo-relay-export-openinference/SKILL.md
  • skills/nemo-relay-export-atif-trajectories/SKILL.md
**/SKILL.md

📄 CodeRabbit inference engine (AGENTS.md)

SKILL.md files are skill entrypoints and must start with YAML frontmatter containing at least name and description.

Files:

  • skills/nemo-relay-setup-observability/SKILL.md
  • skills/nemo-relay-export-openinference/SKILL.md
  • skills/nemo-relay-export-atif-trajectories/SKILL.md

⚙️ CodeRabbit configuration file

**/SKILL.md: Do not flag SKILL.md files for missing SPDX headers. Skill entrypoints intentionally start with YAML frontmatter instead.
Verify that every SKILL.md keeps valid YAML frontmatter with at least name and description fields before the Markdown body.

Files:

  • skills/nemo-relay-setup-observability/SKILL.md
  • skills/nemo-relay-export-openinference/SKILL.md
  • skills/nemo-relay-export-atif-trajectories/SKILL.md
**/*.{md,mdx}

📄 CodeRabbit inference engine (AGENTS.md)

Update README.md, fern/, package READMEs, and binding-support notes when public behavior, package names, examples, or supported bindings change.

**/*.{md,mdx}: Prefer the documented public API, not internal shortcuts
Keep package names, repo references, and build commands current
Keep release-process and release-notes guidance in repo-maintainer docs such as RELEASING.md, not as user-facing docs pages or CHANGELOG.md
Keep stable user-facing wrappers at scripts/ root in docs and examples; only point at namespaced helper paths when documenting internal maintenance work
When detailed dynamic plugin guides exist, keep Rust native plugin examples, Python worker plugin examples, and grpc-v1 protocol details on separate pages

If links in documentation change, run just docs-linkcheck.

Files:

  • skills/nemo-relay-setup-observability/SKILL.md
  • docs/nemo-relay-cli/codex.mdx
  • skills/nemo-relay-export-openinference/SKILL.md
  • docs/nemo-relay-cli/claude-code.mdx
  • docs/configure-plugins/observability/atof.mdx
  • docs/nemo-relay-cli/basic-usage.mdx
  • docs/instrument-applications/instrument-llm-call.mdx
  • skills/nemo-relay-export-atif-trajectories/SKILL.md
  • docs/about-nemo-relay/concepts/events.mdx
**/*.{md,markdown,mdx}

📄 CodeRabbit inference engine (CONTRIBUTING.md)

Add the SPDX license header to all Markdown/MDX documentation files using the HTML comment block form.

Files:

  • skills/nemo-relay-setup-observability/SKILL.md
  • docs/nemo-relay-cli/codex.mdx
  • skills/nemo-relay-export-openinference/SKILL.md
  • docs/nemo-relay-cli/claude-code.mdx
  • docs/configure-plugins/observability/atof.mdx
  • docs/nemo-relay-cli/basic-usage.mdx
  • docs/instrument-applications/instrument-llm-call.mdx
  • skills/nemo-relay-export-atif-trajectories/SKILL.md
  • docs/about-nemo-relay/concepts/events.mdx
**/*

📄 CodeRabbit inference engine (.agents/skills/validate-change/SKILL.md)

**/*: Format changed files with the language-native formatter before the final lint/test pass.
If dynamic plugin behavior changed, use maintain-dynamic-plugins and include the native SDK, worker protocol, Python SDK, docs, packaging, and Codecov surfaces in the validation plan.
If code changes alter APIs, bindings, commands, paths, packaging behavior, observability/adaptive semantics, or documented best practices, update any dependent maintainer or consumer skills in the same branch.
During iteration, prefer uv run pre-commit run --files <changed files...>.
Before review or handoff, run uv run pre-commit run --all-files.

Files:

  • skills/nemo-relay-setup-observability/SKILL.md
  • docs/nemo-relay-cli/codex.mdx
  • crates/cli/tests/coverage/adapters_tests.rs
  • skills/nemo-relay-export-openinference/SKILL.md
  • docs/nemo-relay-cli/claude-code.mdx
  • docs/configure-plugins/observability/atof.mdx
  • docs/nemo-relay-cli/basic-usage.mdx
  • docs/instrument-applications/instrument-llm-call.mdx
  • skills/nemo-relay-export-atif-trajectories/SKILL.md
  • docs/about-nemo-relay/concepts/events.mdx
  • crates/core/src/api/scope.rs
  • crates/core/tests/unit/context_tests.rs
  • crates/core/src/api/runtime/scope_stack.rs
  • crates/cli/src/adapters/mod.rs
  • crates/core/src/api/llm.rs
  • crates/core/tests/unit/llm_api_tests.rs
**

⚙️ CodeRabbit configuration file

**:

AGENTS.md

This file provides guidance to agents, including Claude Code and OpenAI Codex, when working in this repository.

Project Overview

NeMo Relay is a multi-language agent runtime framework for execution scopes, lifecycle events, middleware, plugins, and observability around tool and LLM calls. The core runtime is Rust. Primary supported bindings are Rust, Python, and Node.js. Go and the raw C FFI are experimental and source-first.

The shared runtime model is:

  1. Scope stacks decide where work belongs and which scope-local behavior is visible.
  2. Middleware registries decide what guardrails and intercepts run around managed calls.
  3. Plugins install reusable runtime behavior from configuration.
  4. Events record runtime behavior in ATOF form.
  5. Subscribers and exporters consume events in-process or export them to ATIF, OpenTelemetry, OpenInference, or other backends.

Repository Structure

The repository layout separates the Rust runtime, language bindings,
documentation, integrations, and agent-facing skills.

crates/
  core/       # Rust core runtime crate, published as nemo-relay
  adaptive/   # Adaptive runtime primitives and plugin components
  python/     # PyO3 native extension for the Python package
  ffi/        # Raw C ABI layer used by downstream bindings such as Go
  node/       # NAPI Node.js binding and JavaScript/TypeScript entry points
python/
  nemo_relay/  # Python wrapper package: scopes, tools, LLM, middleware, typed helpers, plugins, adaptive helpers
  tests/      # Python tests
go/
  nemo_relay/  # Experimental Go CGo binding and tests
fern/         # Fern documentation site
scripts/      # Stable wrappers and helper scripts; build/test/docs entry points live in justfile
skills/       # Published Codex/agent skills for NeMo Relay usage patterns

Prerequisites

Insta...

Files:

  • skills/nemo-relay-setup-observability/SKILL.md
  • docs/nemo-relay-cli/codex.mdx
  • crates/cli/tests/coverage/adapters_tests.rs
  • skills/nemo-relay-export-openinference/SKILL.md
  • docs/nemo-relay-cli/claude-code.mdx
  • docs/configure-plugins/observability/atof.mdx
  • docs/nemo-relay-cli/basic-usage.mdx
  • docs/instrument-applications/instrument-llm-call.mdx
  • skills/nemo-relay-export-atif-trajectories/SKILL.md
  • docs/about-nemo-relay/concepts/events.mdx
  • crates/core/src/api/scope.rs
  • crates/core/tests/unit/context_tests.rs
  • crates/core/src/api/runtime/scope_stack.rs
  • crates/cli/src/adapters/mod.rs
  • crates/core/src/api/llm.rs
  • crates/core/tests/unit/llm_api_tests.rs
**/*.mdx

📄 CodeRabbit inference engine (.agents/skills/review-doc-style/SKILL.md)

MDX top-of-file SPDX comments must use {/* ... */} delimiters instead of HTML comment delimiters (Must-Fix)

In MDX files, top-of-file comments must use JSX comment delimiters ({/* to open and */} to close); do not use HTML comments for MDX SPDX headers

Files:

  • docs/nemo-relay-cli/codex.mdx
  • docs/nemo-relay-cli/claude-code.mdx
  • docs/configure-plugins/observability/atof.mdx
  • docs/nemo-relay-cli/basic-usage.mdx
  • docs/instrument-applications/instrument-llm-call.mdx
  • docs/about-nemo-relay/concepts/events.mdx
{docs,examples}/**/*

📄 CodeRabbit inference engine (.agents/skills/rename-surfaces/SKILL.md)

Update docs and examples.

Files:

  • docs/nemo-relay-cli/codex.mdx
  • docs/nemo-relay-cli/claude-code.mdx
  • docs/configure-plugins/observability/atof.mdx
  • docs/nemo-relay-cli/basic-usage.mdx
  • docs/instrument-applications/instrument-llm-call.mdx
  • docs/about-nemo-relay/concepts/events.mdx
docs/**/*

📄 CodeRabbit inference engine (.agents/skills/validate-change/SKILL.md)

If documentation examples or commands under docs/ change, run the targeted docs checks appropriate to the change.

Files:

  • docs/nemo-relay-cli/codex.mdx
  • docs/nemo-relay-cli/claude-code.mdx
  • docs/configure-plugins/observability/atof.mdx
  • docs/nemo-relay-cli/basic-usage.mdx
  • docs/instrument-applications/instrument-llm-call.mdx
  • docs/about-nemo-relay/concepts/events.mdx
{docs/**,README.md,CONTRIBUTING.md,RELEASING.md,SECURITY.md}

⚙️ CodeRabbit configuration file

{docs/**,README.md,CONTRIBUTING.md,RELEASING.md,SECURITY.md}: Review documentation for technical accuracy against the current API, command correctness, and consistency across language bindings.
Flag stale examples, missing SPDX headers where required, and instructions that no longer match CI or pre-commit behavior.

Files:

  • docs/nemo-relay-cli/codex.mdx
  • docs/nemo-relay-cli/claude-code.mdx
  • docs/configure-plugins/observability/atof.mdx
  • docs/nemo-relay-cli/basic-usage.mdx
  • docs/instrument-applications/instrument-llm-call.mdx
  • docs/about-nemo-relay/concepts/events.mdx
**/*.rs

📄 CodeRabbit inference engine (.agents/skills/prepare-pr/SKILL.md)

**/*.rs: Any Rust change must run just test-rust
Any Rust change must run cargo fmt --all
Any Rust change must run cargo clippy --workspace --all-targets -- -D warnings

**/*.rs: Run cargo fmt --all for all FFI work since it is Rust work
Run just test-rust to validate FFI changes
Run cargo clippy --workspace --all-targets -- -D warnings to enforce strict linting on FFI work

When Rust files changed as part of Go work, also run cargo fmt --all, just test-rust, and cargo clippy --workspace --all-targets -- -D warnings

**/*.rs: Run cargo fmt --all when Rust files are changed as part of Node work
Run cargo clippy --workspace --all-targets -- -D warnings when Rust files are changed as part of Node work
Run just test-rust when Rust files are changed as part of Node work

When changing the core Rust runtime or Rust-facing API surface, format Rust code with cargo fmt (rustfmt defaults), keep cargo clippy -- -D warnings clean, and satisfy cargo deny check per deny.toml.

**/*.rs: If any Rust code changed, always run just test-rust.
If any Rust code changed, also run cargo fmt --all.
If any Rust code changed, also run cargo clippy --workspace --all-targets -- -D warnings.
For Rust changes headed for review, run cargo fmt --all and cargo clippy --workspace --all-targets -- -D warnings even if relying on pre-commit.

Files:

  • crates/cli/tests/coverage/adapters_tests.rs
  • crates/core/src/api/scope.rs
  • crates/core/tests/unit/context_tests.rs
  • crates/core/src/api/runtime/scope_stack.rs
  • crates/cli/src/adapters/mod.rs
  • crates/core/src/api/llm.rs
  • crates/core/tests/unit/llm_api_tests.rs
**/*.{rs,py}

📄 CodeRabbit inference engine (AGENTS.md)

Follow binding naming conventions in Rust and Python: use snake_case.

Files:

  • crates/cli/tests/coverage/adapters_tests.rs
  • crates/core/src/api/scope.rs
  • crates/core/tests/unit/context_tests.rs
  • crates/core/src/api/runtime/scope_stack.rs
  • crates/cli/src/adapters/mod.rs
  • crates/core/src/api/llm.rs
  • crates/core/tests/unit/llm_api_tests.rs
**/*.{rs,py,js,mjs,cjs,ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

**/*.{rs,py,js,mjs,cjs,ts,tsx}: Use Json = serde_json::Value in Rust-facing runtime APIs where the existing code expects JSON payloads.
Use Result<T> with FlowError in core runtime paths, and keep errors explicit and binding-appropriate at the wrapper layer.
Keep async behavior on the existing tokio-based model; bindings should preserve callback and future lifetimes rather than blocking or hiding async work unexpectedly.

Files:

  • crates/cli/tests/coverage/adapters_tests.rs
  • crates/core/src/api/scope.rs
  • crates/core/tests/unit/context_tests.rs
  • crates/core/src/api/runtime/scope_stack.rs
  • crates/cli/src/adapters/mod.rs
  • crates/core/src/api/llm.rs
  • crates/core/tests/unit/llm_api_tests.rs
**/*.{rs,py,go,js,ts,c,h}

📄 CodeRabbit inference engine (CONTRIBUTING.md)

Use language-appropriate naming conventions: Rust snake_case, C FFI exports prefixed nemo_relay_, Go PascalCase, Node.js camelCase, and Python snake_case.

Files:

  • crates/cli/tests/coverage/adapters_tests.rs
  • crates/core/src/api/scope.rs
  • crates/core/tests/unit/context_tests.rs
  • crates/core/src/api/runtime/scope_stack.rs
  • crates/cli/src/adapters/mod.rs
  • crates/core/src/api/llm.rs
  • crates/core/tests/unit/llm_api_tests.rs
**/*.{rs,go,js,ts}

📄 CodeRabbit inference engine (CONTRIBUTING.md)

Add the SPDX license header to all Rust, Go, JavaScript, and TypeScript source files using the corresponding // comment form.

Files:

  • crates/cli/tests/coverage/adapters_tests.rs
  • crates/core/src/api/scope.rs
  • crates/core/tests/unit/context_tests.rs
  • crates/core/src/api/runtime/scope_stack.rs
  • crates/cli/src/adapters/mod.rs
  • crates/core/src/api/llm.rs
  • crates/core/tests/unit/llm_api_tests.rs
**/*.{rs,py,go,js,ts}

📄 CodeRabbit inference engine (.agents/skills/validate-change/SKILL.md)

If a language surface changed, always run that language's test target even when Rust core did not change.

Files:

  • crates/cli/tests/coverage/adapters_tests.rs
  • crates/core/src/api/scope.rs
  • crates/core/tests/unit/context_tests.rs
  • crates/core/src/api/runtime/scope_stack.rs
  • crates/cli/src/adapters/mod.rs
  • crates/core/src/api/llm.rs
  • crates/core/tests/unit/llm_api_tests.rs
{crates/**/tests/**,python/tests/**,go/nemo_relay/**/*_test.go}

⚙️ CodeRabbit configuration file

{crates/**/tests/**,python/tests/**,go/nemo_relay/**/*_test.go}: Tests should cover the behavior promised by the changed API surface, including error paths and cross-request isolation where relevant.
Prefer assertions on lifecycle events, scope stacks, middleware ordering, and binding parity over shallow smoke tests.

Files:

  • crates/cli/tests/coverage/adapters_tests.rs
  • crates/core/tests/unit/context_tests.rs
  • crates/core/tests/unit/llm_api_tests.rs
{crates/core,crates/adaptive}/**/*

📄 CodeRabbit inference engine (.agents/skills/prepare-pr/SKILL.md)

Changes to crates/core or crates/adaptive must run the full language matrix

Files:

  • crates/core/src/api/scope.rs
  • crates/core/tests/unit/context_tests.rs
  • crates/core/src/api/runtime/scope_stack.rs
  • crates/core/src/api/llm.rs
  • crates/core/tests/unit/llm_api_tests.rs
crates/core/**/*.rs

📄 CodeRabbit inference engine (.agents/skills/test-go-binding/SKILL.md)

If the change touched crates/core or shared runtime semantics, also use validate-change for broader validation

Files:

  • crates/core/src/api/scope.rs
  • crates/core/tests/unit/context_tests.rs
  • crates/core/src/api/runtime/scope_stack.rs
  • crates/core/src/api/llm.rs
  • crates/core/tests/unit/llm_api_tests.rs
crates/core/src/{api/**/*.rs,api/runtime/**/*.rs,codec/**/*.rs,json.rs}

📄 CodeRabbit inference engine (.agents/skills/add-binding-feature/SKILL.md)

Implement the new or changed public runtime behavior first in the Rust core, especially under crates/core/src/api/ and related core modules such as crates/core/src/api/runtime/, crates/core/src/codec/, and crates/core/src/json.rs.

Files:

  • crates/core/src/api/scope.rs
  • crates/core/src/api/runtime/scope_stack.rs
  • crates/core/src/api/llm.rs
{crates/**/src/**/*.rs,python/**/*.py}

📄 CodeRabbit inference engine (.agents/skills/maintain-dynamic-plugins/SKILL.md)

Do not add tests under src; Rust tests belong in crate tests/ trees, and Python SDK tests belong under python/tests.

Files:

  • crates/core/src/api/scope.rs
  • crates/core/src/api/runtime/scope_stack.rs
  • crates/cli/src/adapters/mod.rs
  • crates/core/src/api/llm.rs
crates/{core,adaptive}/**/*

📄 CodeRabbit inference engine (.agents/skills/validate-change/SKILL.md)

If crates/core or crates/adaptive changed, run the full validation matrix across Rust, Python, Go, and Node.js.

Files:

  • crates/core/src/api/scope.rs
  • crates/core/tests/unit/context_tests.rs
  • crates/core/src/api/runtime/scope_stack.rs
  • crates/core/src/api/llm.rs
  • crates/core/tests/unit/llm_api_tests.rs
crates/{core,adaptive}/**/*.rs

⚙️ CodeRabbit configuration file

crates/{core,adaptive}/**/*.rs: Review the Rust runtime for async correctness, scope isolation, middleware ordering, and event lifecycle regressions.
Pay close attention to task-local/thread-local scope propagation, callback lifetimes, stream finalization, and root_uuid isolation.
Public API changes should preserve existing behavior unless tests and docs show the intended migration path.

Files:

  • crates/core/src/api/scope.rs
  • crates/core/tests/unit/context_tests.rs
  • crates/core/src/api/runtime/scope_stack.rs
  • crates/core/src/api/llm.rs
  • crates/core/tests/unit/llm_api_tests.rs
crates/core/src/api/{tool,llm}.rs

📄 CodeRabbit inference engine (.agents/skills/add-middleware/SKILL.md)

Wire the new middleware chain into the execute path in crates/core/src/api/tool.rs or crates/core/src/api/llm.rs at the appropriate pipeline stage

Files:

  • crates/core/src/api/llm.rs
🔇 Additional comments (15)
crates/cli/src/adapters/mod.rs (1)

9-9: 📐 Maintainability & Code Quality

Confirm the required Rust validation before merge.

The compaction mapping is consistent with the downstream NormalizedEvent::Compaction contract. Because this is a Rust change, confirm that just test-rust, cargo fmt --all, and cargo clippy --workspace --all-targets -- -D warnings pass.

As per path instructions, “Any Rust change must run just test-rust,” cargo fmt --all, and cargo clippy --workspace --all-targets -- -D warnings.

Also applies to: 899-907

Source: Path instructions

crates/cli/tests/coverage/adapters_tests.rs (1)

933-934: LGTM!

docs/about-nemo-relay/concepts/events.mdx (1)

83-96: LGTM!

Also applies to: 111-111

docs/instrument-applications/instrument-llm-call.mdx (1)

241-248: LGTM!

docs/nemo-relay-cli/basic-usage.mdx (1)

309-310: LGTM!

docs/nemo-relay-cli/claude-code.mdx (1)

125-129: LGTM!

docs/nemo-relay-cli/codex.mdx (1)

184-185: LGTM!

skills/nemo-relay-export-atif-trajectories/SKILL.md (1)

26-29: LGTM!

crates/core/src/api/llm.rs (2)

433-444: 🩺 Stability & Availability

Freshness reservation is atomic; emission ordering is not.

take_agent_freshness is consumed under the write lock, but the lock is released before projection, event construction, sanitization, and subscriber dispatch. Two concurrent starts on a shared/propagated stack can still reserve freshness in one order but dispatch events in the other, so "the first subscriber-visible start is the baseline" isn't actually guaranteed — only exclusive consumption is. This matches an unresolved concern from a prior review round without an explicit "addressed" confirmation.


32-32: LGTM!

Also applies to: 301-341, 371-380, 422-424, 453-453, 581-584

crates/core/src/api/runtime/scope_stack.rs (2)

12-12: LGTM!

Also applies to: 25-51, 60-64, 146-146, 178-189, 251-251


162-176: 🗄️ Data Integrity & Integration

No action needed here. parent_uuid is derived from the active stack or an explicit parent handle, and the captured stack travels with the handle, so this fallback only affects invalid caller input.

			> Likely an incorrect or invalid review comment.
crates/core/src/api/scope.rs (1)

22-24: LGTM!

Also applies to: 334-345

crates/core/tests/unit/context_tests.rs (1)

98-137: LGTM!

crates/core/tests/unit/llm_api_tests.rs (1)

8-30: LGTM!

Also applies to: 54-627

Comment thread crates/core/src/api/llm.rs
Comment thread docs/configure-plugins/observability/atof.mdx Outdated
Comment thread skills/nemo-relay-export-openinference/SKILL.md Outdated
Comment thread skills/nemo-relay-setup-observability/SKILL.md Outdated
Comment thread crates/core/tests/unit/llm_api_tests.rs
@willkill07 willkill07 force-pushed the feat/relay-445-limit-llm-event-context branch from 5879962 to 8913295 Compare July 10, 2026 23:42

@mnajafian-nv mnajafian-nv left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@crates/core/src/api/scope.rs`:
- Around line 334-341: The compaction freshness transition and LLM-start event
enqueue are not serialized through a common ordering boundary. Update the
relevant scope event lifecycle functions, including the compaction handling
around `current_scope_stack` and `emit_llm_start_with_subscribers`, so each
agent’s freshness re-arm or consumption remains reserved until dispatcher
acceptance, preserving compaction-before-start and start-before-start ordering.
Add deterministic regressions in `crates/core` covering both ordering cases and
verify freshness is atomically consumed at LLM start without affecting scope
isolation.

In `@skills/nemo-relay-export-atif-trajectories/SKILL.md`:
- Around line 26-29: Update the documentation around request annotations in the
relevant skill guidance to precisely describe the stale projection: after the
initial/fresh session state is consumed, the annotation retains the current user
turn along with retained system instructions and subsequent assistant/tool
messages, rather than only the user turn. Verify the wording against the current
request codec and annotation API behavior.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Enterprise

Run ID: a89fd4b0-03b5-4c8b-9537-6304af17ee06

📥 Commits

Reviewing files that changed from the base of the PR and between 5879962 and 8913295.

📒 Files selected for processing (16)
  • crates/cli/src/adapters/mod.rs
  • crates/cli/tests/coverage/adapters_tests.rs
  • crates/core/src/api/llm.rs
  • crates/core/src/api/runtime/scope_stack.rs
  • crates/core/src/api/scope.rs
  • crates/core/tests/unit/context_tests.rs
  • crates/core/tests/unit/llm_api_tests.rs
  • docs/about-nemo-relay/concepts/events.mdx
  • docs/configure-plugins/observability/atof.mdx
  • docs/instrument-applications/instrument-llm-call.mdx
  • docs/nemo-relay-cli/basic-usage.mdx
  • docs/nemo-relay-cli/claude-code.mdx
  • docs/nemo-relay-cli/codex.mdx
  • skills/nemo-relay-export-atif-trajectories/SKILL.md
  • skills/nemo-relay-export-openinference/SKILL.md
  • skills/nemo-relay-setup-observability/SKILL.md
📜 Review details
🧰 Additional context used
📓 Path-based instructions (28)
**/*.mdx

📄 CodeRabbit inference engine (.agents/skills/review-doc-style/SKILL.md)

MDX top-of-file SPDX comments must use {/* ... */} delimiters instead of HTML comment delimiters (Must-Fix)

In MDX files, top-of-file comments must use JSX comment delimiters ({/* to open and */} to close); do not use HTML comments for MDX SPDX headers

Files:

  • docs/nemo-relay-cli/basic-usage.mdx
  • docs/configure-plugins/observability/atof.mdx
  • docs/nemo-relay-cli/codex.mdx
  • docs/nemo-relay-cli/claude-code.mdx
  • docs/about-nemo-relay/concepts/events.mdx
  • docs/instrument-applications/instrument-llm-call.mdx
**/*.{md,mdx}

📄 CodeRabbit inference engine (AGENTS.md)

Update README.md, fern/, package READMEs, and binding-support notes when public behavior, package names, examples, or supported bindings change.

**/*.{md,mdx}: Prefer the documented public API, not internal shortcuts
Keep package names, repo references, and build commands current
Keep release-process and release-notes guidance in repo-maintainer docs such as RELEASING.md, not as user-facing docs pages or CHANGELOG.md
Keep stable user-facing wrappers at scripts/ root in docs and examples; only point at namespaced helper paths when documenting internal maintenance work
When detailed dynamic plugin guides exist, keep Rust native plugin examples, Python worker plugin examples, and grpc-v1 protocol details on separate pages

If links in documentation change, run just docs-linkcheck.

Files:

  • docs/nemo-relay-cli/basic-usage.mdx
  • skills/nemo-relay-export-openinference/SKILL.md
  • docs/configure-plugins/observability/atof.mdx
  • skills/nemo-relay-setup-observability/SKILL.md
  • docs/nemo-relay-cli/codex.mdx
  • skills/nemo-relay-export-atif-trajectories/SKILL.md
  • docs/nemo-relay-cli/claude-code.mdx
  • docs/about-nemo-relay/concepts/events.mdx
  • docs/instrument-applications/instrument-llm-call.mdx
**/*.{md,markdown,mdx}

📄 CodeRabbit inference engine (CONTRIBUTING.md)

Add the SPDX license header to all Markdown/MDX documentation files using the HTML comment block form.

Files:

  • docs/nemo-relay-cli/basic-usage.mdx
  • skills/nemo-relay-export-openinference/SKILL.md
  • docs/configure-plugins/observability/atof.mdx
  • skills/nemo-relay-setup-observability/SKILL.md
  • docs/nemo-relay-cli/codex.mdx
  • skills/nemo-relay-export-atif-trajectories/SKILL.md
  • docs/nemo-relay-cli/claude-code.mdx
  • docs/about-nemo-relay/concepts/events.mdx
  • docs/instrument-applications/instrument-llm-call.mdx
{docs,examples}/**/*

📄 CodeRabbit inference engine (.agents/skills/rename-surfaces/SKILL.md)

Update docs and examples.

Files:

  • docs/nemo-relay-cli/basic-usage.mdx
  • docs/configure-plugins/observability/atof.mdx
  • docs/nemo-relay-cli/codex.mdx
  • docs/nemo-relay-cli/claude-code.mdx
  • docs/about-nemo-relay/concepts/events.mdx
  • docs/instrument-applications/instrument-llm-call.mdx
**/*

📄 CodeRabbit inference engine (.agents/skills/validate-change/SKILL.md)

**/*: Format changed files with the language-native formatter before the final lint/test pass.
If dynamic plugin behavior changed, use maintain-dynamic-plugins and include the native SDK, worker protocol, Python SDK, docs, packaging, and Codecov surfaces in the validation plan.
If code changes alter APIs, bindings, commands, paths, packaging behavior, observability/adaptive semantics, or documented best practices, update any dependent maintainer or consumer skills in the same branch.
During iteration, prefer uv run pre-commit run --files <changed files...>.
Before review or handoff, run uv run pre-commit run --all-files.

Files:

  • docs/nemo-relay-cli/basic-usage.mdx
  • skills/nemo-relay-export-openinference/SKILL.md
  • docs/configure-plugins/observability/atof.mdx
  • skills/nemo-relay-setup-observability/SKILL.md
  • docs/nemo-relay-cli/codex.mdx
  • skills/nemo-relay-export-atif-trajectories/SKILL.md
  • docs/nemo-relay-cli/claude-code.mdx
  • crates/core/src/api/scope.rs
  • crates/core/tests/unit/context_tests.rs
  • crates/cli/src/adapters/mod.rs
  • docs/about-nemo-relay/concepts/events.mdx
  • crates/cli/tests/coverage/adapters_tests.rs
  • docs/instrument-applications/instrument-llm-call.mdx
  • crates/core/src/api/runtime/scope_stack.rs
  • crates/core/src/api/llm.rs
  • crates/core/tests/unit/llm_api_tests.rs
docs/**/*

📄 CodeRabbit inference engine (.agents/skills/validate-change/SKILL.md)

If documentation examples or commands under docs/ change, run the targeted docs checks appropriate to the change.

Files:

  • docs/nemo-relay-cli/basic-usage.mdx
  • docs/configure-plugins/observability/atof.mdx
  • docs/nemo-relay-cli/codex.mdx
  • docs/nemo-relay-cli/claude-code.mdx
  • docs/about-nemo-relay/concepts/events.mdx
  • docs/instrument-applications/instrument-llm-call.mdx
**

⚙️ CodeRabbit configuration file

**:

AGENTS.md

This file provides guidance to agents, including Claude Code and OpenAI Codex, when working in this repository.

Project Overview

NeMo Relay is a multi-language agent runtime framework for execution scopes, lifecycle events, middleware, plugins, and observability around tool and LLM calls. The core runtime is Rust. Primary supported bindings are Rust, Python, and Node.js. Go and the raw C FFI are experimental and source-first.

The shared runtime model is:

  1. Scope stacks decide where work belongs and which scope-local behavior is visible.
  2. Middleware registries decide what guardrails and intercepts run around managed calls.
  3. Plugins install reusable runtime behavior from configuration.
  4. Events record runtime behavior in ATOF form.
  5. Subscribers and exporters consume events in-process or export them to ATIF, OpenTelemetry, OpenInference, or other backends.

Repository Structure

The repository layout separates the Rust runtime, language bindings,
documentation, integrations, and agent-facing skills.

crates/
  core/       # Rust core runtime crate, published as nemo-relay
  adaptive/   # Adaptive runtime primitives and plugin components
  python/     # PyO3 native extension for the Python package
  ffi/        # Raw C ABI layer used by downstream bindings such as Go
  node/       # NAPI Node.js binding and JavaScript/TypeScript entry points
python/
  nemo_relay/  # Python wrapper package: scopes, tools, LLM, middleware, typed helpers, plugins, adaptive helpers
  tests/      # Python tests
go/
  nemo_relay/  # Experimental Go CGo binding and tests
fern/         # Fern documentation site
scripts/      # Stable wrappers and helper scripts; build/test/docs entry points live in justfile
skills/       # Published Codex/agent skills for NeMo Relay usage patterns

Prerequisites

Insta...

Files:

  • docs/nemo-relay-cli/basic-usage.mdx
  • skills/nemo-relay-export-openinference/SKILL.md
  • docs/configure-plugins/observability/atof.mdx
  • skills/nemo-relay-setup-observability/SKILL.md
  • docs/nemo-relay-cli/codex.mdx
  • skills/nemo-relay-export-atif-trajectories/SKILL.md
  • docs/nemo-relay-cli/claude-code.mdx
  • crates/core/src/api/scope.rs
  • crates/core/tests/unit/context_tests.rs
  • crates/cli/src/adapters/mod.rs
  • docs/about-nemo-relay/concepts/events.mdx
  • crates/cli/tests/coverage/adapters_tests.rs
  • docs/instrument-applications/instrument-llm-call.mdx
  • crates/core/src/api/runtime/scope_stack.rs
  • crates/core/src/api/llm.rs
  • crates/core/tests/unit/llm_api_tests.rs
{docs/**,README.md,CONTRIBUTING.md,RELEASING.md,SECURITY.md}

⚙️ CodeRabbit configuration file

{docs/**,README.md,CONTRIBUTING.md,RELEASING.md,SECURITY.md}: Review documentation for technical accuracy against the current API, command correctness, and consistency across language bindings.
Flag stale examples, missing SPDX headers where required, and instructions that no longer match CI or pre-commit behavior.

Files:

  • docs/nemo-relay-cli/basic-usage.mdx
  • docs/configure-plugins/observability/atof.mdx
  • docs/nemo-relay-cli/codex.mdx
  • docs/nemo-relay-cli/claude-code.mdx
  • docs/about-nemo-relay/concepts/events.mdx
  • docs/instrument-applications/instrument-llm-call.mdx
**/*.{md,rst,html,txt}

📄 CodeRabbit inference engine (.agents/skills/review-doc-style/assets/nvidia-style-brand-terminology.md)

**/*.{md,rst,html,txt}: Always spell NVIDIA in all caps. Do not use Nvidia, nvidia, nVidia, nVIDIA, or NV.
Use an NVIDIA before a noun because the name starts with an 'en' sound.
Do not add a registered trademark symbol after NVIDIA when referring to the company.
Use trademark symbols with product names only when the document type or legal guidance requires them.
Verify official capitalization, spacing, and hyphenation for product names.
Precede NVIDIA product names with NVIDIA on first mention when it is natural and accurate.
Do not rewrite product names for grammar or title-case rules.
Preserve third-party product names according to the owner's spelling.
Include the company name and full model qualifier on first use when it helps identify the model.
Preserve the official capitalization and punctuation of model names.
Use shorter family names only after the full name is established.
Spell out a term on first use and put the acronym in parentheses unless the acronym is widely understood by the intended audience.
Use the acronym on later mentions after it has been defined.
For long documents, reintroduce the full term if readers might lose context.
Form plurals of acronyms with s, not an apostrophe, such as GPUs.
In headings, common acronyms can remain abbreviated. Spell out the term in the first or second sentence of the body.
Common terms such as CPU, GPU, PC, API, and UI usually do not need to be spelled out for developer audiences.

Files:

  • skills/nemo-relay-export-openinference/SKILL.md
  • skills/nemo-relay-setup-observability/SKILL.md
  • skills/nemo-relay-export-atif-trajectories/SKILL.md
**/*.{md,rst,html}

📄 CodeRabbit inference engine (.agents/skills/review-doc-style/assets/nvidia-style-brand-terminology.md)

Link the first mention of a product name when the destination helps the reader.

Files:

  • skills/nemo-relay-export-openinference/SKILL.md
  • skills/nemo-relay-setup-observability/SKILL.md
  • skills/nemo-relay-export-atif-trajectories/SKILL.md
**/*.{md,rst,txt}

📄 CodeRabbit inference engine (.agents/skills/review-doc-style/assets/nvidia-style-guide.md)

Spell NVIDIA in all caps. Do not use Nvidia, nvidia, or NV.

Files:

  • skills/nemo-relay-export-openinference/SKILL.md
  • skills/nemo-relay-setup-observability/SKILL.md
  • skills/nemo-relay-export-atif-trajectories/SKILL.md
**/*.{md,rst}

📄 CodeRabbit inference engine (.agents/skills/review-doc-style/assets/nvidia-style-guide.md)

**/*.{md,rst}: Format commands, code elements, expressions, package names, file names, and paths as inline code.
Use descriptive link text. Avoid raw URLs and weak anchors such as "here" or "read more."
Use title case consistently for technical documentation headings.
Introduce code blocks, lists, tables, and images with complete sentences.
Write procedures as imperative steps. Keep steps parallel and split long procedures into smaller tasks.
Prefer active voice, present tense, short sentences, contractions, and plain English.
Use can for possibility and reserve may for permission.
Use after for temporal relationships instead of once.
Prefer refer to over see when the wording points readers to another resource.
Avoid culture-specific idioms, unnecessary Latinisms, jokes, and marketing exaggeration in technical docs.
Spell out months in body text, avoid ordinal dates, and use clear time zones.
Spell out whole numbers from zero through nine unless they are technical values, parameters, versions, or UI values.
Use numerals for 10 or greater and include commas in thousands.
Do not add trademark symbols to learning-oriented docs unless the source, platform, or legal guidance explicitly requires them.

Files:

  • skills/nemo-relay-export-openinference/SKILL.md
  • skills/nemo-relay-setup-observability/SKILL.md
  • skills/nemo-relay-export-atif-trajectories/SKILL.md
**/*.md

📄 CodeRabbit inference engine (.agents/skills/review-doc-style/assets/nvidia-style-technical-docs.md)

**/*.md: Use title case consistently in technical documentation headings
Avoid quotation marks, ampersands, and exclamation marks in headings
Keep product, event, research, and whitepaper names in their official title case
Use title case for table headers
Do not force social-media sentence case into technical docs
Format code elements, commands, parameters, package names, and expressions in monospace
Format directories, file names, and paths in monospace using backticks
Use angle brackets inside monospace for variables inside paths, such as /home/<username>/.login
Format error messages and strings in quotation marks, keeping literal code strings in code formatting when clearer
Format UI buttons, menus, fields, and labels in bold
Use angle brackets between UI labels for menu paths, such as File > Save As
Use italics for new terms on first use, sparingly and only when introducing the term
Use italics for publication titles
Format keyboard shortcuts in plain text, such as Press Ctrl+Alt+Delete
Use owner/repo link text for GitHub repositories, preferring [NVIDIA/NeMo](link) over prose references like 'the GitHub repo'
Introduce every code block with a complete sentence
Do not make a code block complete the grammar of the previous sentence
Do not continue a sentence after a code block
Use syntax highlighting when the format supports it for code blocks
Avoid the word 'snippet' unless the surrounding docs already use it as a term of art
Keep inline method, function, and class references consistent with nearby docs, omitting empty parentheses for prose readability when no call is shown
Use descriptive anchor text that matches the destination title when possible for links
Avoid raw URLs in running text
Avoid generic anchor text such as 'here,' 'this page,' and 'read more'
Include acronyms in link text when a linked term includes an acronym
Do not link long sentences or multiple sentences
Avoid links that pull readers away from a procedure unless the link is a p...

Files:

  • skills/nemo-relay-export-openinference/SKILL.md
  • skills/nemo-relay-setup-observability/SKILL.md
  • skills/nemo-relay-export-atif-trajectories/SKILL.md
**/SKILL.md

📄 CodeRabbit inference engine (AGENTS.md)

SKILL.md files are skill entrypoints and must start with YAML frontmatter containing at least name and description.

Files:

  • skills/nemo-relay-export-openinference/SKILL.md
  • skills/nemo-relay-setup-observability/SKILL.md
  • skills/nemo-relay-export-atif-trajectories/SKILL.md

⚙️ CodeRabbit configuration file

**/SKILL.md: Do not flag SKILL.md files for missing SPDX headers. Skill entrypoints intentionally start with YAML frontmatter instead.
Verify that every SKILL.md keeps valid YAML frontmatter with at least name and description fields before the Markdown body.

Files:

  • skills/nemo-relay-export-openinference/SKILL.md
  • skills/nemo-relay-setup-observability/SKILL.md
  • skills/nemo-relay-export-atif-trajectories/SKILL.md
**/*.rs

📄 CodeRabbit inference engine (.agents/skills/prepare-pr/SKILL.md)

**/*.rs: Any Rust change must run just test-rust
Any Rust change must run cargo fmt --all
Any Rust change must run cargo clippy --workspace --all-targets -- -D warnings

**/*.rs: Run cargo fmt --all for all FFI work since it is Rust work
Run just test-rust to validate FFI changes
Run cargo clippy --workspace --all-targets -- -D warnings to enforce strict linting on FFI work

When Rust files changed as part of Go work, also run cargo fmt --all, just test-rust, and cargo clippy --workspace --all-targets -- -D warnings

**/*.rs: Run cargo fmt --all when Rust files are changed as part of Node work
Run cargo clippy --workspace --all-targets -- -D warnings when Rust files are changed as part of Node work
Run just test-rust when Rust files are changed as part of Node work

When changing the core Rust runtime or Rust-facing API surface, format Rust code with cargo fmt (rustfmt defaults), keep cargo clippy -- -D warnings clean, and satisfy cargo deny check per deny.toml.

**/*.rs: If any Rust code changed, always run just test-rust.
If any Rust code changed, also run cargo fmt --all.
If any Rust code changed, also run cargo clippy --workspace --all-targets -- -D warnings.
For Rust changes headed for review, run cargo fmt --all and cargo clippy --workspace --all-targets -- -D warnings even if relying on pre-commit.

Files:

  • crates/core/src/api/scope.rs
  • crates/core/tests/unit/context_tests.rs
  • crates/cli/src/adapters/mod.rs
  • crates/cli/tests/coverage/adapters_tests.rs
  • crates/core/src/api/runtime/scope_stack.rs
  • crates/core/src/api/llm.rs
  • crates/core/tests/unit/llm_api_tests.rs
{crates/core,crates/adaptive}/**/*

📄 CodeRabbit inference engine (.agents/skills/prepare-pr/SKILL.md)

Changes to crates/core or crates/adaptive must run the full language matrix

Files:

  • crates/core/src/api/scope.rs
  • crates/core/tests/unit/context_tests.rs
  • crates/core/src/api/runtime/scope_stack.rs
  • crates/core/src/api/llm.rs
  • crates/core/tests/unit/llm_api_tests.rs
crates/core/**/*.rs

📄 CodeRabbit inference engine (.agents/skills/test-go-binding/SKILL.md)

If the change touched crates/core or shared runtime semantics, also use validate-change for broader validation

Files:

  • crates/core/src/api/scope.rs
  • crates/core/tests/unit/context_tests.rs
  • crates/core/src/api/runtime/scope_stack.rs
  • crates/core/src/api/llm.rs
  • crates/core/tests/unit/llm_api_tests.rs
**/*.{rs,py}

📄 CodeRabbit inference engine (AGENTS.md)

Follow binding naming conventions in Rust and Python: use snake_case.

Files:

  • crates/core/src/api/scope.rs
  • crates/core/tests/unit/context_tests.rs
  • crates/cli/src/adapters/mod.rs
  • crates/cli/tests/coverage/adapters_tests.rs
  • crates/core/src/api/runtime/scope_stack.rs
  • crates/core/src/api/llm.rs
  • crates/core/tests/unit/llm_api_tests.rs
**/*.{rs,py,js,mjs,cjs,ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

**/*.{rs,py,js,mjs,cjs,ts,tsx}: Use Json = serde_json::Value in Rust-facing runtime APIs where the existing code expects JSON payloads.
Use Result<T> with FlowError in core runtime paths, and keep errors explicit and binding-appropriate at the wrapper layer.
Keep async behavior on the existing tokio-based model; bindings should preserve callback and future lifetimes rather than blocking or hiding async work unexpectedly.

Files:

  • crates/core/src/api/scope.rs
  • crates/core/tests/unit/context_tests.rs
  • crates/cli/src/adapters/mod.rs
  • crates/cli/tests/coverage/adapters_tests.rs
  • crates/core/src/api/runtime/scope_stack.rs
  • crates/core/src/api/llm.rs
  • crates/core/tests/unit/llm_api_tests.rs
**/*.{rs,py,go,js,ts,c,h}

📄 CodeRabbit inference engine (CONTRIBUTING.md)

Use language-appropriate naming conventions: Rust snake_case, C FFI exports prefixed nemo_relay_, Go PascalCase, Node.js camelCase, and Python snake_case.

Files:

  • crates/core/src/api/scope.rs
  • crates/core/tests/unit/context_tests.rs
  • crates/cli/src/adapters/mod.rs
  • crates/cli/tests/coverage/adapters_tests.rs
  • crates/core/src/api/runtime/scope_stack.rs
  • crates/core/src/api/llm.rs
  • crates/core/tests/unit/llm_api_tests.rs
**/*.{rs,go,js,ts}

📄 CodeRabbit inference engine (CONTRIBUTING.md)

Add the SPDX license header to all Rust, Go, JavaScript, and TypeScript source files using the corresponding // comment form.

Files:

  • crates/core/src/api/scope.rs
  • crates/core/tests/unit/context_tests.rs
  • crates/cli/src/adapters/mod.rs
  • crates/cli/tests/coverage/adapters_tests.rs
  • crates/core/src/api/runtime/scope_stack.rs
  • crates/core/src/api/llm.rs
  • crates/core/tests/unit/llm_api_tests.rs
crates/core/src/{api/**/*.rs,api/runtime/**/*.rs,codec/**/*.rs,json.rs}

📄 CodeRabbit inference engine (.agents/skills/add-binding-feature/SKILL.md)

Implement the new or changed public runtime behavior first in the Rust core, especially under crates/core/src/api/ and related core modules such as crates/core/src/api/runtime/, crates/core/src/codec/, and crates/core/src/json.rs.

Files:

  • crates/core/src/api/scope.rs
  • crates/core/src/api/runtime/scope_stack.rs
  • crates/core/src/api/llm.rs
{crates/**/src/**/*.rs,python/**/*.py}

📄 CodeRabbit inference engine (.agents/skills/maintain-dynamic-plugins/SKILL.md)

Do not add tests under src; Rust tests belong in crate tests/ trees, and Python SDK tests belong under python/tests.

Files:

  • crates/core/src/api/scope.rs
  • crates/cli/src/adapters/mod.rs
  • crates/core/src/api/runtime/scope_stack.rs
  • crates/core/src/api/llm.rs
crates/{core,adaptive}/**/*

📄 CodeRabbit inference engine (.agents/skills/validate-change/SKILL.md)

If crates/core or crates/adaptive changed, run the full validation matrix across Rust, Python, Go, and Node.js.

Files:

  • crates/core/src/api/scope.rs
  • crates/core/tests/unit/context_tests.rs
  • crates/core/src/api/runtime/scope_stack.rs
  • crates/core/src/api/llm.rs
  • crates/core/tests/unit/llm_api_tests.rs
**/*.{rs,py,go,js,ts}

📄 CodeRabbit inference engine (.agents/skills/validate-change/SKILL.md)

If a language surface changed, always run that language's test target even when Rust core did not change.

Files:

  • crates/core/src/api/scope.rs
  • crates/core/tests/unit/context_tests.rs
  • crates/cli/src/adapters/mod.rs
  • crates/cli/tests/coverage/adapters_tests.rs
  • crates/core/src/api/runtime/scope_stack.rs
  • crates/core/src/api/llm.rs
  • crates/core/tests/unit/llm_api_tests.rs
crates/{core,adaptive}/**/*.rs

⚙️ CodeRabbit configuration file

crates/{core,adaptive}/**/*.rs: Review the Rust runtime for async correctness, scope isolation, middleware ordering, and event lifecycle regressions.
Pay close attention to task-local/thread-local scope propagation, callback lifetimes, stream finalization, and root_uuid isolation.
Public API changes should preserve existing behavior unless tests and docs show the intended migration path.

Files:

  • crates/core/src/api/scope.rs
  • crates/core/tests/unit/context_tests.rs
  • crates/core/src/api/runtime/scope_stack.rs
  • crates/core/src/api/llm.rs
  • crates/core/tests/unit/llm_api_tests.rs
{crates/**/tests/**,python/tests/**,go/nemo_relay/**/*_test.go}

⚙️ CodeRabbit configuration file

{crates/**/tests/**,python/tests/**,go/nemo_relay/**/*_test.go}: Tests should cover the behavior promised by the changed API surface, including error paths and cross-request isolation where relevant.
Prefer assertions on lifecycle events, scope stacks, middleware ordering, and binding parity over shallow smoke tests.

Files:

  • crates/core/tests/unit/context_tests.rs
  • crates/cli/tests/coverage/adapters_tests.rs
  • crates/core/tests/unit/llm_api_tests.rs
crates/core/src/api/{tool,llm}.rs

📄 CodeRabbit inference engine (.agents/skills/add-middleware/SKILL.md)

Wire the new middleware chain into the execute path in crates/core/src/api/tool.rs or crates/core/src/api/llm.rs at the appropriate pipeline stage

Files:

  • crates/core/src/api/llm.rs
🔇 Additional comments (17)
crates/cli/src/adapters/mod.rs (1)

9-9: LGTM!

Also applies to: 899-907

crates/cli/tests/coverage/adapters_tests.rs (1)

933-934: LGTM!

docs/about-nemo-relay/concepts/events.mdx (1)

83-96: LGTM!

Also applies to: 111-111

docs/configure-plugins/observability/atof.mdx (1)

104-108: LGTM!

skills/nemo-relay-export-openinference/SKILL.md (1)

32-36: LGTM!

skills/nemo-relay-setup-observability/SKILL.md (1)

41-45: LGTM!

docs/instrument-applications/instrument-llm-call.mdx (1)

241-248: LGTM!

docs/nemo-relay-cli/basic-usage.mdx (1)

309-310: LGTM!

docs/nemo-relay-cli/claude-code.mdx (1)

125-129: LGTM!

docs/nemo-relay-cli/codex.mdx (1)

184-188: LGTM!

crates/core/src/api/runtime/scope_stack.rs (3)

12-62: LGTM!

Also applies to: 146-146, 251-251


162-176: 🗄️ Data Integrity & Integration

Do Not Map an Unknown Parent to the Current Agent

When parent_uuid is absent from stack, map_or(self.stack.len(), ...) searches the entire stack and selects the topmost agent. A closed or foreign explicit parent can therefore consume or re-arm another agent’s freshness. Verify callers reject parents outside the captured stack; otherwise return an error instead of falling back.

As per path instructions, pay close attention to scope propagation and root_uuid isolation.

Source: Path instructions


12-251: 📐 Maintainability & Code Quality

Record the Required Core-Runtime Validation

Confirm this change passes cargo fmt --all, strict workspace Clippy, cargo deny check, just test-rust, validate-change, the Python, Go, and Node.js test targets, and the final all-files pre-commit pass.

As per coding guidelines, Rust and core-runtime changes require these Rust checks and the full language matrix. As per path instructions, changes under crates/core require broader validation.

Sources: Coding guidelines, Path instructions

crates/core/src/api/scope.rs (1)

22-23: LGTM!

Also applies to: 342-345

crates/core/tests/unit/context_tests.rs (1)

98-136: LGTM!

crates/core/src/api/llm.rs (1)

32-32: LGTM!

Also applies to: 301-383, 425-435, 456-456, 584-587

crates/core/tests/unit/llm_api_tests.rs (1)

8-626: LGTM!

Comment thread crates/core/src/api/scope.rs
Comment thread skills/nemo-relay-export-atif-trajectories/SKILL.md Outdated
Track freshness for the implicit root and nested agents, re-arm it on canonical compaction marks, and let non-agent scopes inherit their nearest agent state. Preserve complete request history for one fresh LLM start, then retain instructions and the latest user turn in both the annotation and codec-backed event input without changing provider execution. Keep event-only codec projection fail-open with diagnostics, normalize PostCompact, and cover managed, streaming, nested, concurrent, projection, and compaction behavior.

Refs: RELAY-445

BREAKING CHANGE: LLM start request events may omit prior turns after the owning agent's freshness has been consumed.

Signed-off-by: Will Killian <wkillian@nvidia.com>
@willkill07 willkill07 force-pushed the feat/relay-445-limit-llm-event-context branch from 8913295 to dc9e1bc Compare July 11, 2026 00:03

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@crates/core/src/api/runtime/scope_stack.rs`:
- Around line 162-176: Validate an explicit parent UUID in owning_agent_uuid
before calculating the search range: if parent_uuid is Some but not found in
self.stack, reject it rather than treating it as None or searching the full
stack. Preserve the existing agent lookup for valid parents and absent parents,
using the project’s established error or result-handling convention to report
the stale or foreign ScopeHandle.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Enterprise

Run ID: 88491191-59f4-4e10-bd96-de0faa17f006

📥 Commits

Reviewing files that changed from the base of the PR and between 8913295 and dc9e1bc.

📒 Files selected for processing (7)
  • crates/cli/src/adapters/mod.rs
  • crates/cli/tests/coverage/adapters_tests.rs
  • crates/core/src/api/llm.rs
  • crates/core/src/api/runtime/scope_stack.rs
  • crates/core/src/api/scope.rs
  • crates/core/tests/unit/context_tests.rs
  • crates/core/tests/unit/llm_api_tests.rs
📜 Review details
⏰ Context from checks skipped due to timeout. (3)
  • GitHub Check: Check / Run
  • GitHub Check: CodeRabbit
  • GitHub Check: Preview docs
🧰 Additional context used
📓 Path-based instructions (16)
**/*.rs

📄 CodeRabbit inference engine (.agents/skills/prepare-pr/SKILL.md)

**/*.rs: Any Rust change must run just test-rust
Any Rust change must run cargo fmt --all
Any Rust change must run cargo clippy --workspace --all-targets -- -D warnings

**/*.rs: Run cargo fmt --all for all FFI work since it is Rust work
Run just test-rust to validate FFI changes
Run cargo clippy --workspace --all-targets -- -D warnings to enforce strict linting on FFI work

When Rust files changed as part of Go work, also run cargo fmt --all, just test-rust, and cargo clippy --workspace --all-targets -- -D warnings

**/*.rs: Run cargo fmt --all when Rust files are changed as part of Node work
Run cargo clippy --workspace --all-targets -- -D warnings when Rust files are changed as part of Node work
Run just test-rust when Rust files are changed as part of Node work

When changing the core Rust runtime or Rust-facing API surface, format Rust code with cargo fmt (rustfmt defaults), keep cargo clippy -- -D warnings clean, and satisfy cargo deny check per deny.toml.

**/*.rs: If any Rust code changed, always run just test-rust.
If any Rust code changed, also run cargo fmt --all.
If any Rust code changed, also run cargo clippy --workspace --all-targets -- -D warnings.
For Rust changes headed for review, run cargo fmt --all and cargo clippy --workspace --all-targets -- -D warnings even if relying on pre-commit.

Files:

  • crates/core/src/api/scope.rs
  • crates/core/tests/unit/context_tests.rs
  • crates/cli/src/adapters/mod.rs
  • crates/cli/tests/coverage/adapters_tests.rs
  • crates/core/src/api/runtime/scope_stack.rs
  • crates/core/src/api/llm.rs
  • crates/core/tests/unit/llm_api_tests.rs
{crates/core,crates/adaptive}/**/*

📄 CodeRabbit inference engine (.agents/skills/prepare-pr/SKILL.md)

Changes to crates/core or crates/adaptive must run the full language matrix

Files:

  • crates/core/src/api/scope.rs
  • crates/core/tests/unit/context_tests.rs
  • crates/core/src/api/runtime/scope_stack.rs
  • crates/core/src/api/llm.rs
  • crates/core/tests/unit/llm_api_tests.rs
crates/core/**/*.rs

📄 CodeRabbit inference engine (.agents/skills/test-go-binding/SKILL.md)

If the change touched crates/core or shared runtime semantics, also use validate-change for broader validation

Files:

  • crates/core/src/api/scope.rs
  • crates/core/tests/unit/context_tests.rs
  • crates/core/src/api/runtime/scope_stack.rs
  • crates/core/src/api/llm.rs
  • crates/core/tests/unit/llm_api_tests.rs
**/*.{rs,py}

📄 CodeRabbit inference engine (AGENTS.md)

Follow binding naming conventions in Rust and Python: use snake_case.

Files:

  • crates/core/src/api/scope.rs
  • crates/core/tests/unit/context_tests.rs
  • crates/cli/src/adapters/mod.rs
  • crates/cli/tests/coverage/adapters_tests.rs
  • crates/core/src/api/runtime/scope_stack.rs
  • crates/core/src/api/llm.rs
  • crates/core/tests/unit/llm_api_tests.rs
**/*.{rs,py,js,mjs,cjs,ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

**/*.{rs,py,js,mjs,cjs,ts,tsx}: Use Json = serde_json::Value in Rust-facing runtime APIs where the existing code expects JSON payloads.
Use Result<T> with FlowError in core runtime paths, and keep errors explicit and binding-appropriate at the wrapper layer.
Keep async behavior on the existing tokio-based model; bindings should preserve callback and future lifetimes rather than blocking or hiding async work unexpectedly.

Files:

  • crates/core/src/api/scope.rs
  • crates/core/tests/unit/context_tests.rs
  • crates/cli/src/adapters/mod.rs
  • crates/cli/tests/coverage/adapters_tests.rs
  • crates/core/src/api/runtime/scope_stack.rs
  • crates/core/src/api/llm.rs
  • crates/core/tests/unit/llm_api_tests.rs
**/*.{rs,py,go,js,ts,c,h}

📄 CodeRabbit inference engine (CONTRIBUTING.md)

Use language-appropriate naming conventions: Rust snake_case, C FFI exports prefixed nemo_relay_, Go PascalCase, Node.js camelCase, and Python snake_case.

Files:

  • crates/core/src/api/scope.rs
  • crates/core/tests/unit/context_tests.rs
  • crates/cli/src/adapters/mod.rs
  • crates/cli/tests/coverage/adapters_tests.rs
  • crates/core/src/api/runtime/scope_stack.rs
  • crates/core/src/api/llm.rs
  • crates/core/tests/unit/llm_api_tests.rs
**/*.{rs,go,js,ts}

📄 CodeRabbit inference engine (CONTRIBUTING.md)

Add the SPDX license header to all Rust, Go, JavaScript, and TypeScript source files using the corresponding // comment form.

Files:

  • crates/core/src/api/scope.rs
  • crates/core/tests/unit/context_tests.rs
  • crates/cli/src/adapters/mod.rs
  • crates/cli/tests/coverage/adapters_tests.rs
  • crates/core/src/api/runtime/scope_stack.rs
  • crates/core/src/api/llm.rs
  • crates/core/tests/unit/llm_api_tests.rs
crates/core/src/{api/**/*.rs,api/runtime/**/*.rs,codec/**/*.rs,json.rs}

📄 CodeRabbit inference engine (.agents/skills/add-binding-feature/SKILL.md)

Implement the new or changed public runtime behavior first in the Rust core, especially under crates/core/src/api/ and related core modules such as crates/core/src/api/runtime/, crates/core/src/codec/, and crates/core/src/json.rs.

Files:

  • crates/core/src/api/scope.rs
  • crates/core/src/api/runtime/scope_stack.rs
  • crates/core/src/api/llm.rs
{crates/**/src/**/*.rs,python/**/*.py}

📄 CodeRabbit inference engine (.agents/skills/maintain-dynamic-plugins/SKILL.md)

Do not add tests under src; Rust tests belong in crate tests/ trees, and Python SDK tests belong under python/tests.

Files:

  • crates/core/src/api/scope.rs
  • crates/cli/src/adapters/mod.rs
  • crates/core/src/api/runtime/scope_stack.rs
  • crates/core/src/api/llm.rs
**/*

📄 CodeRabbit inference engine (.agents/skills/validate-change/SKILL.md)

**/*: Format changed files with the language-native formatter before the final lint/test pass.
If dynamic plugin behavior changed, use maintain-dynamic-plugins and include the native SDK, worker protocol, Python SDK, docs, packaging, and Codecov surfaces in the validation plan.
If code changes alter APIs, bindings, commands, paths, packaging behavior, observability/adaptive semantics, or documented best practices, update any dependent maintainer or consumer skills in the same branch.
During iteration, prefer uv run pre-commit run --files <changed files...>.
Before review or handoff, run uv run pre-commit run --all-files.

Files:

  • crates/core/src/api/scope.rs
  • crates/core/tests/unit/context_tests.rs
  • crates/cli/src/adapters/mod.rs
  • crates/cli/tests/coverage/adapters_tests.rs
  • crates/core/src/api/runtime/scope_stack.rs
  • crates/core/src/api/llm.rs
  • crates/core/tests/unit/llm_api_tests.rs
crates/{core,adaptive}/**/*

📄 CodeRabbit inference engine (.agents/skills/validate-change/SKILL.md)

If crates/core or crates/adaptive changed, run the full validation matrix across Rust, Python, Go, and Node.js.

Files:

  • crates/core/src/api/scope.rs
  • crates/core/tests/unit/context_tests.rs
  • crates/core/src/api/runtime/scope_stack.rs
  • crates/core/src/api/llm.rs
  • crates/core/tests/unit/llm_api_tests.rs
**/*.{rs,py,go,js,ts}

📄 CodeRabbit inference engine (.agents/skills/validate-change/SKILL.md)

If a language surface changed, always run that language's test target even when Rust core did not change.

Files:

  • crates/core/src/api/scope.rs
  • crates/core/tests/unit/context_tests.rs
  • crates/cli/src/adapters/mod.rs
  • crates/cli/tests/coverage/adapters_tests.rs
  • crates/core/src/api/runtime/scope_stack.rs
  • crates/core/src/api/llm.rs
  • crates/core/tests/unit/llm_api_tests.rs
**

⚙️ CodeRabbit configuration file

**:

AGENTS.md

This file provides guidance to agents, including Claude Code and OpenAI Codex, when working in this repository.

Project Overview

NeMo Relay is a multi-language agent runtime framework for execution scopes, lifecycle events, middleware, plugins, and observability around tool and LLM calls. The core runtime is Rust. Primary supported bindings are Rust, Python, and Node.js. Go and the raw C FFI are experimental and source-first.

The shared runtime model is:

  1. Scope stacks decide where work belongs and which scope-local behavior is visible.
  2. Middleware registries decide what guardrails and intercepts run around managed calls.
  3. Plugins install reusable runtime behavior from configuration.
  4. Events record runtime behavior in ATOF form.
  5. Subscribers and exporters consume events in-process or export them to ATIF, OpenTelemetry, OpenInference, or other backends.

Repository Structure

The repository layout separates the Rust runtime, language bindings,
documentation, integrations, and agent-facing skills.

crates/
  core/       # Rust core runtime crate, published as nemo-relay
  adaptive/   # Adaptive runtime primitives and plugin components
  python/     # PyO3 native extension for the Python package
  ffi/        # Raw C ABI layer used by downstream bindings such as Go
  node/       # NAPI Node.js binding and JavaScript/TypeScript entry points
python/
  nemo_relay/  # Python wrapper package: scopes, tools, LLM, middleware, typed helpers, plugins, adaptive helpers
  tests/      # Python tests
go/
  nemo_relay/  # Experimental Go CGo binding and tests
fern/         # Fern documentation site
scripts/      # Stable wrappers and helper scripts; build/test/docs entry points live in justfile
skills/       # Published Codex/agent skills for NeMo Relay usage patterns

Prerequisites

Insta...

Files:

  • crates/core/src/api/scope.rs
  • crates/core/tests/unit/context_tests.rs
  • crates/cli/src/adapters/mod.rs
  • crates/cli/tests/coverage/adapters_tests.rs
  • crates/core/src/api/runtime/scope_stack.rs
  • crates/core/src/api/llm.rs
  • crates/core/tests/unit/llm_api_tests.rs
crates/{core,adaptive}/**/*.rs

⚙️ CodeRabbit configuration file

crates/{core,adaptive}/**/*.rs: Review the Rust runtime for async correctness, scope isolation, middleware ordering, and event lifecycle regressions.
Pay close attention to task-local/thread-local scope propagation, callback lifetimes, stream finalization, and root_uuid isolation.
Public API changes should preserve existing behavior unless tests and docs show the intended migration path.

Files:

  • crates/core/src/api/scope.rs
  • crates/core/tests/unit/context_tests.rs
  • crates/core/src/api/runtime/scope_stack.rs
  • crates/core/src/api/llm.rs
  • crates/core/tests/unit/llm_api_tests.rs
{crates/**/tests/**,python/tests/**,go/nemo_relay/**/*_test.go}

⚙️ CodeRabbit configuration file

{crates/**/tests/**,python/tests/**,go/nemo_relay/**/*_test.go}: Tests should cover the behavior promised by the changed API surface, including error paths and cross-request isolation where relevant.
Prefer assertions on lifecycle events, scope stacks, middleware ordering, and binding parity over shallow smoke tests.

Files:

  • crates/core/tests/unit/context_tests.rs
  • crates/cli/tests/coverage/adapters_tests.rs
  • crates/core/tests/unit/llm_api_tests.rs
crates/core/src/api/{tool,llm}.rs

📄 CodeRabbit inference engine (.agents/skills/add-middleware/SKILL.md)

Wire the new middleware chain into the execute path in crates/core/src/api/tool.rs or crates/core/src/api/llm.rs at the appropriate pipeline stage

Files:

  • crates/core/src/api/llm.rs
🔇 Additional comments (9)
crates/cli/src/adapters/mod.rs (2)

9-9: LGTM!

Also applies to: 899-901


899-901: 📐 Maintainability & Code Quality

Run the required Rust validation before merge.

Please confirm just test-rust, cargo fmt --all, cargo clippy --workspace --all-targets -- -D warnings, and uv run pre-commit run --all-files pass. As per coding guidelines and path instructions, these checks are required for Rust changes.

Sources: Coding guidelines, Path instructions

crates/cli/tests/coverage/adapters_tests.rs (1)

933-934: LGTM!

crates/core/src/api/runtime/scope_stack.rs (1)

12-12: LGTM!

Also applies to: 25-33, 47-51, 60-62, 146-146, 251-251

crates/core/src/api/scope.rs (1)

22-23: LGTM!

Also applies to: 334-345

crates/core/src/api/llm.rs (2)

32-32: LGTM!

Also applies to: 301-340, 384-403, 425-460, 584-587


342-382: 🎯 Functional Correctness

No developer role exists in Messagecrates/types/src/codec/request.rs only defines System, User, Assistant, and Tool, so this typed projection cannot drop a separate developer instruction role.

			> Likely an incorrect or invalid review comment.
crates/core/tests/unit/llm_api_tests.rs (1)

8-30: LGTM!

Also applies to: 54-104, 105-163, 165-230, 232-330, 332-434, 436-517, 519-572, 574-626

crates/core/tests/unit/context_tests.rs (1)

98-136: LGTM!

Comment thread crates/core/src/api/runtime/scope_stack.rs
@willkill07 willkill07 removed the request for review from lvojtku July 11, 2026 00:14
@willkill07

Copy link
Copy Markdown
Member Author

/merge

@rapids-bot rapids-bot Bot merged commit fba935c into NVIDIA:main Jul 11, 2026
70 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

breaking PR introduces a breaking change Feature a new feature lang:rust PR changes/introduces Rust code size:L PR is large

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants